<?php
session_start();
require_once('Connections/dbsvr.php'); //connect to student server
require_once('Connections/groupaware.php'); //connect to testing server
//get variables passed from the schedule creation page
$userid = $HTTP_POST_VARS['userid'];
//these are arrays of data..
//values range from 1 to 31, based on the depth from the top of the page.
//so 1 would be 8:30, 31 would be 11:00 at night
$sunday = $HTTP_POST_VARS['sunday'];
$monday = $HTTP_POST_VARS['monday'];
$tuesday = $HTTP_POST_VARS['tuesday'];
$wednesday = $HTTP_POST_VARS['wednesday'];
$thursday = $HTTP_POST_VARS['thursday'];
$friday = $HTTP_POST_VARS['friday'];
$saturday = $HTTP_POST_VARS['saturday'];
$selected = mysql_select_db($database_dbsvr, $dbsvr);
//deletes the users past schedule first before inputting the new one
$insertSQL = "DELETE FROM user_unavailable
WHERE( User_ID like '$sess_userid')";
$Result1 = mysql_query($insertSQL) or die(mysql_error());
$days = array(1 => 'sunday', 'monday', 'tuesday', 'wednesday',
'thursday', 'friday', 'saturday');
//loops through each day inputting each time selected into the database as unavailable time
for($i = 1; $i < 8; $i++) {
$tempArray = $$days[$i];
$length = count($tempArray);
for($z = 0; $z < $length; $z++)
{
$insertSQL = "INSERT INTO user_unavailable(Day,Time,User_ID)
VALUES($i,$tempArray[$z],'$sess_userid')";
$Result1 = mysql_query($insertSQL) or die(mysql_error());
}
}
//mysql_close($dbh);
?>
<html>
<head>
<title>GroupAware : Schedules</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="group.css" rel="stylesheet" type="text/css">
<link href="blocks.css" rel="stylesheet" type="text/css">
</head>
<body vlink="#333333" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="125" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="75" valign="bottom" bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="125" height="110"><font size="7" face="Arial, Helvetica, sans-serif"><strong><a href="index.php"><img src="groupAwareLogoSm2.gif" alt="logo" width="103" height="99" border="0" align="absmiddle"></a></strong></font></td>
<td><img src="spacer.gif" width="20" height="8"><font size="7" face="Arial, Helvetica, sans-serif"><strong>Group<font color="#003366">Aware</font>
<font size="4"><br>
<img src="spacer.gif" width="150" height="1">Meeting Time Organizer</font></strong></font></td>
<td width="200" valign="top" class="css">
<div align="right"><strong><font size="1"><a href="about.php"> <font size="2">About</font></a><font size="2">
| <a href="faq.php">FAQ</a> | <a href="contact.php">Contact</a><img src="spacer.gif" width="10" height="8"></font></font></strong> </div></td>
</tr>
</table>
<div align="right">
<table width="500" height="25" border="0" cellpadding="0" cellspacing="0" bordercolor="#660000" class="tabs">
<tr valign="middle" class="tabs">
<td width="100" bgcolor="#660000" class="tabs">
<div align="center" class="css"><font color="#FFFFFF"><strong>Edit
Schedule</strong></font></div></td>
<td width="100" bgcolor="#FFFFFF" class="tabs">
<div align="center" class="css"><a href="groups.php"><strong>View
My Groups</strong></a></div></td>
<td width="100" bgcolor="#FFFFFF" class="tabs"> <div align="center" class="css"><strong><a href="create.php">Create
a Group</a></strong></div></td>
<td width="100" bgcolor="#FFFFFF" class="tabs"> <div align="center" class="css"><strong><a href="account.php">My
Account</font></a></strong></div></td>
<td width="100" nowrap bgcolor="#FFFFFF" class="tabs"> <div align="center" class="css"><strong><a href="index.php?action=logout">Log
Out </a></font></strong></div></td>
</tr>
</table>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5" bgcolor="#660000" class="css"><img src="spacer.gif" width="1" height="1"></td>
</tr>
</table>
</td>
</tr>
<!--
<tr>
<td height="7" colspan="2" bgcolor="#660000"><img src="spacer.gif" width="1" height="1"></td>
</tr>
-->
</table>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"> <p align="center" class="css"><font size="1"><br>
<br>
<br>
</font></p>
<p align="center" class="css"> </p>
<p align="center" class="css">
Your schedule has been saved into the database successfully for user <?php //echo $sess_userid; ?>.<br>
<br>
<font size="1"><a href="groups.php">Back</a></font></p> </td>
</tr>
<tr>
<td height="20" valign="top"><div align="center"><font size="1" face="Arial, Helvetica, sans-serif">This
site was created by IST students at The Pennsylvania State University.
Use of this system is subject to the terms and conditions set forth.<br>
Copyright 2005</font><font size="1"><br>
<br>
</font></div></td>
</tr>
</table>
</body>
</html>