use Date::Manip; use DBI(); use CGI qw(:standard); require "../common.pl"; require "../sitevariables.pl"; $cur = CGI->new(); $mode = "default"; if($cur->param("mode")) { $mode = $cur->param("mode"); } $day = $cur->param("day"); $month = $cur->param("month"); $year = $cur->param("year"); $sec = $cur->param("sec"); $min = $cur->param("min"); $hour = $cur->param("hour"); $end_min = $cur->param("end_min"); $end_hour = $cur->param("end_hour"); $end_am_pm = $cur->param("end_am_pm"); $am_pm_day = $cur->param("am_pm_day"); $laptop = $cur->param("laptop"); $conf_room = $cur->param("conf_room"); @am_or_pm = ("","AM","PM"); @end_am_or_pm = ("","AM","PM"); ("","Exec","06","11","16","31","35","47","none"); @pretty_months = ("","January","Febuary","March","April","May","June","July","August","September","October","November","December"); $content .= "
| <-- back to calendar | "; $content .= "
"; die(); } my $return; $return .= "
|
|
";
$newDate = "$year:$month:$day";
$query = "SELECT confName, start_time, end_time FROM Reserves_Conf WHERE resDate='$newDate'";
$select = $db->prepare($query);
$select->errstr, "\n";
$rv = $select->execute() or die "Couldn't execute query '$query' \n";
$select->bind_columns(undef, \$confName,\$start_time,\$end_time);
while($select->fetchrow_arrayref()) {
if($confName eq "Exec") {
$return .= " "; } else { $return .= " "; } } $return .= " |
"; die(); } if($conf_rooms[$update_conf_room] eq "none") { $resCurrent = 1;} else { if(($update_hour == 12) && ($am_or_pm[$update_ampm] eq 'AM')) { $update_hour = 0; } if(($end_hour == 12) && ($end_am_or_pm[$update_endam] eq 'AM')) { $end_hour = 0; } if(($update_hour != 12) && ($end_hour != 12)) { if($am_or_pm[$update_ampm] eq 'PM') { $update_hour = $update_hour + 12; } if($end_am_or_pm[$update_endam] eq 'PM') { $end_hour = $end_hour + 12; } } if ($resCurrent == 1) { print "!! Conference Room: $conf_room, has been reserved during this time period !! \n
" } else { $totime = "$update_hour:$update_min:00"; $endtime = "$end_hour:$end_min:00"; $resrvDate = sprintf("%04d-%02d-%02d", $update_year, $update_month, $update_day); $statement = qq[insert into Reserves_Conf(confID,confName,start_time,end_time, resDate,id) values('$confID','$conf_rooms[$update_conf_room]', '$totime','$endtime','$resrvDate','100000')]; $insert = $db->prepare($statement) or die "Couldn't prepare the query:", $insert->errstr, "\n"; $rv = $insert->execute or die "Order insert failed: ", $insert->errstr, "\n"; } } $db->disconnect(); } sub delete_appointment($$$$){ my $update_conf_rooms = $cur->param("conf_rooms"); my $update_conf_room = $cur->param("conf_room"); my $update_hour = $cur->param("hour"); my $update_min = $cur->param("min"); my $update_year = $cur->param("year");my $update_month = $cur->param("month"); my $update_day = $cur->param("day"); $db = DBI->connect("DBI:mysql:database=dbname;host=localhost", mysql, ""); if(! $db) { print "!!Connection Failed!!
"; die(); } $query = "select confName from Reserves_Conf WHERE confName = '$update_conf_rooms[$update_conf_room]'"; $select = $db->prepare($query); $select->errstr, "\n"; $rv = $select->execute() or die "Couldn't execute query '$query' \n"; $select->bind_columns(undef, \$confName); $newDate = sprintf("%04d-%02d-%02d", $update_year, $update_month, $update_day); $newTime = "$update_hour:$update_min:00"; $statement = "DELETE FROM Reserves_Conf WHERE resDate='$newDate' AND start_time='$newTime'"; $statement = $db->prepare($statement); $statement->errstr, "\n"; $rv = $statement->execute() or die "Couldn't execute query '$query' \n"; $db->disconnect(); }