/includes/assign.php
PHP | 19 lines | 18 code | 0 blank | 1 comment | 3 complexity | 8f293056a704e033fa24b195c9ce67df MD5 | raw file
- <? if ($_SESSION['logged_in'] != true) {
- echo "There has been an error, please go back and try again";
- die();
- }
- $return = escape($_POST['return']);
- $shift = escape($_POST['id']);
- $c_user = escape($_POST['c_id']);
- //check to see if shift is in the past
- $r = mysql_query("SELECT * FROM hours WHERE id='$shift'");
- $r = mysql_fetch_array($r);
- $str = "$r[3]-$r[2]-$r[1]"; //get the date of the shift
- $shift_date = strtotime($str);
- if (time() > $shift_date) {
- echo "You cannot edit shifts that are in the past, redirecting...";
- echo "<META HTTP-EQUIV='Refresh' Content='1; URL=index.php?page=cal&$return'>";
- die();
- }
- mysql_query("UPDATE hours SET worker='$c_user' WHERE id='$shift'");
- echo "<META HTTP-EQUIV='Refresh' Content='0; URL=index.php?page=cal&$return'>";