Please log in to continue.'); if ($_POST['mode'] == 'add') { $errors = 0; $name = $_POST['name']; // Allows: \', a-Z, 0-9 if (!preg_match("/^(\\\\'|[,\\- \w])+$/", $name)) { echo '

Error: Invalid name.

Allowable characters: Alphanumeric characters, " ", "," and "-".
'; $errors++; } if (strlen($name) > 24) $name = substr($name, 0, 21).'...'; $start = $_POST['start']; if (!preg_match("/^((2[0-3])|([01]?\\d)):[0-5]\\d$/", $start)) { echo '

Error: Invalid start time.

Input format: "hh:mm".
'; $errors++; } $end = $_POST['end']; if (!preg_match("/^((2[0-3])|([01]?\\d)):[0-5]\\d$/", $end)) { echo '

Error: Invalid end time.

Input format: "hh:mm".
'; $errors++; } $days = ''; foreach(explode(',','M,T,W,R,F') as $i) if ($_POST[$i] == 'on') $days .= $i; if (empty($days)) { echo '

Error: Select at least one day.

'; $errors++; } $start = explode(':', $start); if ($_POST['sap'] == 'pm' && $start['0'] != '12') $start['0'] += 12; $start = $start['0'].':'.$start['1']; $end = explode(':', $end); if ($_POST['eap'] == 'pm' && $end['0'] != '12') $end['0'] += 12; $end = $end['0'].':'.$end['1']; if (toMins($start) >= toMins($end)) { echo '

Error: This schedule item ends before it starts.

'; $errors++; } if (!$errors) { $query = "INSERT INTO `s_items` VALUES ('', '$name', '$start', '$end', '$days')"; mysql_query($query) or die ('Error: '.mysql_error()); $query = "SELECT `items` FROM `s_users` WHERE user = '$user'"; $result = mysql_query($query) or die ('Error: '.mysql_error()); $list = mysql_result($result, 0); $list .= ((empty($list)) ? '' : ',').mysql_insert_id(); $query = "UPDATE s_users SET items = '$list' WHERE user = '$user'"; mysql_query($query) or die ('Error: '.mysql_error()); } } elseif ($_POST['mode'] == 'delete') { $query = "SELECT `items` FROM `s_users` WHERE user = '$user'"; $result = mysql_query($query) or die ('Error: '.mysql_error()); $list = explode(',', mysql_result($result, 0)); $index = $_POST['id']; if (!preg_match("/^\\d+$/", $index)) { echo "Error: Invalid ID"; } else { if(in_array($index, $list)) { unset($list[array_search($index, $list)]); $items = ''; foreach($list as $i) { $items .= ",$i"; } $items = substr($items, 1); $query = "DELETE FROM `s_items` WHERE `id` = '$index';"; mysql_query($query) or die('Error: '.mysql_error()); mysql_query("ALTER TABLE `s_items` AUTO_INCREMENT = $index") or die('Error: '.mysql_error()); $query = "UPDATE s_users SET items = '$items' WHERE user = '$user'"; mysql_query($query) or die('Error: '.mysql_error()); } } } ?> \n
"; } echo "
"; $name = $start = $end = $sa = $sp = $ea = $ep = ''; $boxes = array(); if ($errors > 0) { $name = ' value="'.stripslashes($_POST['name']).'"'; $start = ' value="'.$_POST['start'].'"'; $end = ' value="'.$_POST['end'].'"'; $sa = ($_POST['sap'] == 'am') ? ' checked' : ''; $sp = ($_POST['sap'] == 'pm') ? ' checked' : ''; $ea = ($_POST['eap'] == 'am') ? ' checked' : ''; $ep = ($_POST['eap'] == 'pm') ? ' checked' : ''; foreach(explode(',', 'M,T,W,R,F') as $i) if ($_POST[$i] == 'on') $boxes[$i] = ' checked'; } echo "\n"; echo ""; echo ""; echo "
Name:
Start:
End:
"; foreach(explode(',', 'M,T,W,R,F') as $n => $i) { echo " "; } ?>
Username: \n"; if ($user != '#') { echo $user."\n
"; echo "
"; echo ""; echo "flags; $str = ">
\n
"; echo "
\n"; $query = "SELECT susers FROM `s_users` WHERE user = '$user'"; $result = mysql_query($query) or die ('Error: '.mysql_error()); $susers = mysql_fetch_object($result); $susers = $susers->susers; if (!empty($susers)) { echo "
\n"; } echo ""; } else { echo "\nPassword: "; echo "\n
\n"; } ?>

Schedule Editor

Delete: Select an item from the dropdown menu and choose Delete to remove it. The page will refresh, and the item will be removed.

Name: You may use the following characters: letters, numbers, spaces, ,, - and '. Try to use no more than 24 characters total, or the name will be cut short.

Start/End: Input a time in 12- or 24-hour hh:mm format. For best results, only schedule items that are at least 45 minutes long. The form will auto-select AM for hours 8:00 through 11:59, and PM for hours 12:00 through 7:59; this can always be changed manually. If you input 24-hour time, either select AM or leave both unmarked.

Weekdays: Make sure to mark at least one.

Go: Click here (or hit [Enter]) when you're done. The page will refresh, clearing the form for another entry.


User Functions

Log In/Log Out sets or deletes a cookie on your machine, to ensure that only you can edit your account.

Share Schedule - This shares your schedule information with everyone who uses this site.

Share With User - Input a friend's username here if you want to share your schedule with specific people, but not the whole Internet.

Unshare Selected - You can remove people from your friends list with this. Useful if you made a typo.