PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/admin/set.php

https://bitbucket.org/d3bugg3r/shiftsystem
PHP | 28 lines | 25 code | 3 blank | 0 comment | 9 complexity | 2b95b5dafa84dc3dbbb2fcf6c6a99e40 MD5 | raw file
  1. <? if ($_SESSION['admin'] != true) {
  2. echo "There has been an error, please go back and try again";
  3. die();
  4. }
  5. if (escape($_POST['type']) == "standard") { //the form submitted was for a standard working week
  6. $i=1;
  7. while ($i<=168) {
  8. $w = escape($_POST[$i]);
  9. mysql_query("UPDATE week SET Available='$w' WHERE ID='$i'");
  10. $i++;
  11. }
  12. echo "<META HTTP-EQUIV='Refresh' Content='0; URL=index.php?p=admin&a=cal&c=1'>";
  13. die();
  14. }
  15. else if (escape($_POST['type']) == "non") {
  16. $w_id = escape($_POST['w_id']);
  17. mysql_query("UPDATE weeks SET standard='0' WHERE ID='$w_id'");
  18. $i = 1;
  19. while ($i<=168) {
  20. $w = escape($_POST[$i]);
  21. mysql_query("UPDATE diff_weeks SET available='$w' WHERE week_id='$w_id' AND a_id='$i'");
  22. $i++;
  23. }
  24. echo "<META HTTP-EQUIV='Refresh' Content='0; URL=index.php?p=admin&a=cal&c=2'>";
  25. }