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