if (isset($Submit)){
//$Continue = "NO";
ConnectMeetingRoom();
$Times = "AM";
$idAM = $HTTP_POST_VARS[idAM];
if( strlen($idAM[0])>0 ) {
$IDAM = $idAM[0];
$Break = '-';
$DateArray = array_reverse(explode('/',$TheDate));
$ReturnDate = implode($Break, $DateArray);
$sql="INSERT INTO booked VALUES(NULL,'$IDAM','$ReturnDate','$Times','$EmployeeId')";
mysql_query( $sql );
}
$Times = "PM";
$idPM = $HTTP_POST_VARS[idPM];
if( strlen($idPM[0])>0 ) {
$IDPM = $idPM[0];
$Break = '-';
$DateArray = array_reverse(explode('/',$TheDate));
$ReturnDate = implode($Break, $DateArray);
$sql="INSERT INTO booked VALUES(NULL,'$IDPM','$ReturnDate','$Times','$EmployeeId')";
mysql_query( $sql );
}
mysql_close();
// this is where i send confiramtion emails to the employee who just
//booked a room
ConnectMeetingRoom();
$sql = "select booked.*, rooms.RoomName from booked LEFT JOIN rooms ON booked.RoomsId = rooms.RoomsId
WHERE booked.WhoId = '$EmployeeId' AND booked.BookedDate = '$ReturnDate' ";
$result = mysql_query($sql);
//
if(mysql_num_rows($result)>0):
$row = mysql_fetch_array($result);
$from = "help.desk@csma.uk.com";
$subject = "Meeting Room Confirmation";
$to = $EmployeeEmail;
$Date = date("d M Y");
while ($row = mysql_fetch_array($result)) {
//
//------------------------------------------------------------------------------------
$message = "Senders name: ".$EmployeeName."\n<br>";
$message.= "Date: ".$Date."\n<br>";
$message .= $row["RoomName"]." has been booked on the ". $TheDate ." ".$row["BookedTime"]."\n";
//
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $from";
//
// Send the message
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo "<font face=Arial size=3 color=\"#ed1c24\"><b>Room booked, confirmation mail sent</b></font><br>";
} else {
echo "<p>Mail could not be sent.</p>";
}
}
//------------------------------------------------------------------------------------
else:
echo "<font face=Arial size=+0 color=\"#CC0000\"><b>There is a Problem obtaining details on the rooms booked</b></font><br>";
endif;
}
?>