[6309] in Perl-Users-Digest
Perl-Users Digest, Issue: 931 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 11 23:17:30 1997
Date: Tue, 11 Feb 97 20:01:34 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 11 Feb 1997 Volume: 7 Number: 931
Today's topics:
perl (hunter be hunted)
Sourcing files from my perl script <cperi@pcocd2.intel.com>
Re: Sourcing files from my perl script (Dave Thomas)
Re: use perl module, @INC, and -I (Dave Thomas)
Where is PerlTk discussed on Usenet <davidr@wv.mentorg.com>
Re: Where is PerlTk discussed on Usenet (Nathan V. Patwardhan)
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Feb 1997 02:46:09 GMT
From: sisiyang@wam.umd.edu (hunter be hunted)
Subject: perl
Message-Id: <5drath$rrl@dailyplanet.wam.umd.edu>
admin.cgi
#
# Auther: David Wang davewang@wam.umd.edu
# Date: March 19, 1996
# Program name: admin.cgi
# nothing here yet.
# program has to go to the "ready queue" and bring
# forth the requests one by one
#
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
###################################################
# CGI output: As HTML
###################################################
# Create an html document on the fly.
print <<"HTML";
<html>
<head>
<title>This is a test page number 1</title>
</head>
<body>
There is nothing here yet.
</body>
</html>
HTML
152431744
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/5/96
Purpose: Print out a summary list of all room
reservations that have been approved. Currently
list is sorted in no particular order.
Companion Code: approve_lt.cgi
**************************************************/
void stanmonth (month)
int month;
{
switch (month) {
case 1: {
printf("<TD>January</TD>");
break;
}
case 2: {
printf("<TD>Febuary</TD>");
break;
}
case 3: {
printf("<TD>March</TD>");
break;
}
case 4: {
printf("<TD>April</TD>");
break;
}
case 5: {
printf("<TD>May</TD>");
break;
}
case 6: {
printf("<TD>June</TD>");
break;
}
case 7: {
printf("<TD>July</TD>");
break;
}
case 8: {
printf("<TD>August</TD>");
break;
}
case 9: {
printf("<TD>September</TD>");
break;
}
case 10: {
printf("<TD>October</TD>");
break;
}
case 11: {
printf("<TD>November</TD>");
break;
}
case 12: {
printf("<TD>December</TD>");
break;
}
}
}
/*covert military time to standard time*/
void stantime(miltime)
int miltime;
{
switch (miltime) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
case 1830: {
printf("6:30 PM");
break;
}
}
}
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Enter a Database query*/
sprintf(tmp_str, "select pid, title, name, e_mail, phone, position, room, month, day, year, start_time, end_time, url_link from approved order by room");
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
/*Identify the number of fields in the table*/
num_fields = msqlNumFields(q_result);
printf("<HR>\n");
printf("<TABLE BORDER>\n");
printf("<TR>\n");
/*print out the tables field names*/
for (i = 0; i < num_fields; i++) {
if (i == 0) { /*check for unque identifier*/
field_value = msqlFetchField(q_result);
printf("<TH></TH>");
} else {
field_value = msqlFetchField(q_result);
printf("<TH>%s</TH>", field_value->name);
}
}
printf("</TR>\n");
printf("\n");
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf("<TR>\n");
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_md.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">",
row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 7) {
stanmonth(atoi(row_value[i]));
} else if (i == 10) {
printf("<TD>");
stantime(atoi(row_value[i]));
printf("</TD>\n");
} else if (i == 11) {
printf("<TD>");
stantime(atoi(row_value[i]));
printf("</TD>\n");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\"><PRE>%s </PRE></A></TD>", row_value[i],
row_value[i]);
} else {
printf("<TD>%s</TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result);
printf("</TR>\n");
printf("\n");
}
printf("</TABLE>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
ang
s/bin/perl
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `approve_lt`;
print <<"HTML";
<title>List of Approved Room Reservation Requests</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H1>List of Approved Room Reservation Requests</H1>
<HR>
<H3>Instructions:</H3>
Select the modification button to the left of the reservation listing
to go to the approval/modification page for the event.
$output
<P>
</BODY>
HTML
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/4/96
Purpose: Take an approved room reservation and
print out in reservation request format.
This page will allow both modifications and
deletions of pre-approved reservations.
Companion Code: approve_md.cgi
**************************************************/
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("1API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Enter a Database query*/
sprintf(tmp_str, "select * from approved where pid = %s", argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("2API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf(" <HTML> ");
printf("<HEAD> ");
printf(" <TITLE>Room scheduler </TITLE> ");
printf("</HEAD>");
printf(" <BODY> <P><B> <FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/submit3.cgi\" METHOD = POST> <BODY BGCOLOR=\"#ffffff\" TEXT=\"#000000\"> ");
printf(" <center> <H2> Room Scheduling Request Form </H2> </center> <hr size=3> <P> ");
printf(" <input type=hidden name = pid value = '%s'>\n", row_value[0]);
printf(" <CODE><b> Requestor Name......</b></FONT></CODE> <INPUT NAME=\"name\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Email address.......</b></FONT></CODE> ", row_value[1]);
printf(" <INPUT NAME=\"email\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Title of the Event..</b></FONT></CODE> ", row_value[2]);
printf(" <INPUT NAME=\"title\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40 ><BR>", row_value[5]);
printf(" <CODE><b> Phone Number........</b></FONT></CODE> <INPUT NAME=\"phone\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40> <BR>", row_value[3]);
printf(" <P><CODE><b>Position</b></FONT></CODE> <select NAME=\"position\">");
printf("<option selected>%s ", row_value[4]);
printf("<option> Student <option> Faculty <option> Other");
printf("</select>");
printf("<p> <code><b>Room to be reserved </b></font></code> ");
printf(" <select name=\"room\"> ");
printf(" <option selected value=\"%s\">%s", row_value[6], row_value[6]);
printf("<option value=\"AVW1112\">AVW1112 <option value=\"AVW1152\">AVW1152 <option value=\"AVW3258\">AVW3258 <option value=\"AVW4185\">AVW4185 <option value=\"Other\">Other </select> ");
printf(" <table><tr><td><code><b>Date...............</b></font></code><td> <select name=\"month\">");
switch (atoi(row_value[7])) {
case 1: {
printf(" <option selected value=1>January ");
break;
}
case 2: {
printf(" <option selected value=2>Febuary ");
break;
}
case 3: {
printf(" <option selected value=3>March ");
break;
}
case 4: {
printf(" <option selected value=4>April ");
break;
}
case 5: {
printf(" <option selected value=5>May ");
break;
}
case 6: {
printf(" <option selected value=6>June ");
break;
}
case 7: {
printf(" <option selected value=7>July ");
break;
}
case 8: {
printf(" <option selected value=8>August ");
break;
}
case 9: {
printf(" <option selected value=9>September ");
break;
}
case 10: {
printf(" <option selected value=10>October ");
break;
}
case 11: {
printf(" <option selected value=11>November ");
break;
}
case 12: {
printf(" <option selected value=12>December ");
break;
}
}
printf(" <option value=1>January <option value=2>February <option value=3>March ", row_value[7], row_value[7]);
printf(" <option value=4>April <option value=5>May <option value=6>June <option value=7>July <option value=8>August <option value=9>September ");
printf(" <option value=10>October <option value=11>November <option value=12>December</select> <td> <select name=\"day\"> <option selected>%s", row_value[8]);
printf("<option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11 <option>12 <option>13 <option>14 <option>15 <option>16 <option>17 <option>18 <option>19 <option>20 <option>21 <option>22 <option>23 <o
ption>24 <option>25 ");
printf(" <option>26 <option>27 <option>28 <option>29 <option>30 <option>31</select> <td> <select name=\"year\"> <option selected>%s <option>1996 <option >1997 <option >1998 <option >1999</select> ", row_value[9]);
printf(" </tr> </table> <table><tr> <td><code><b>Time...............</b></font></code> <td><select name=\"start_time\"> ");
printf(" <option selected value=%s>", row_value[10]);
switch (atoi(row_value[10])) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
}
printf(" <option value=800>8:00 AM <option value=830>8:30 AM <option value=900>9:00 AM ");
printf(" <option value=930>9:30 AM <option value=1000>10:00 AM <option value=1030>10:30 AM <option value=1100>11:00 AM <option value=1130>11:30 AM <option value=1200>12:00 PM <option value=1230>12:30 PM ");
printf(" <option value=1300>1:00 PM <option value=1330>1:30 PM <option value=1400>2:00 PM <option value=1430>2:30 PM <option value=1500>3:00 PM <option value=1530>3:30 PM <option value=1600>4:00 PM <option value=1630>4:30 PM <option value=1700>5:00 PM <o
ption value=1730>5:30 PM ");
printf(" <option value=\"1800\">6:00 PM</select> <td>To: <td><select name=\"end_time\">");
printf(" <option selected value=%s>", row_value[11]);
switch (atoi(row_value[11])) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
case 1830: {
printf("6:30 PM");
break;
}
}
printf(" <option value=\"830\">8:30 AM <option value=\"900\">9:00 AM <option value=\"930\">9:30 AM <option value=\"1000\">10:00 AM ");
printf(" <option value=\"1030\">10:30 AM <option value=\"1100\">11:00 AM <option value=\"1130\">11:30 AM <option value=\"1200\">12:00 PM <option value=\"1230\">12:30 PM <option value=\"1300\">1:00 PM <option value=\"1330\">1:30 PM <option value=\"1400\">
2:00 PM ");
printf(" <option value=\"1430\">2:30 PM <option value=\"1500\">3:00 PM <option value=\"1530\">3:30 PM <option value=\"1600\">4:00 PM <option value=\"1630\">4:30 PM <option value=\"1700\">5:00 PM <option value=\"1730\">5:30 PM <option value=\"1800\">6:00
PM ");
printf(" <option value=\"1830\">6:30 PM</select> </tr> </table> Link to the event web page (optional)<br> <INPUT NAME=\"linkto\" VALUE=\"%s\" MAXLENGTH=\"60\" SIZE=\"60\" ><BR> Or, Short description of the event<BR> ", row_value[12]);
printf(" <TEXTAREA NAME=\"description\" ROWS=3 COLS=50>%s</TEXTAREA> <BR> <hr size=2> <P><CENTER> <INPUT TYPE=\"SUBMIT\" VALUE=\"Modify\"> <INPUT TYPE=\"RESET\" VALUE=\"Reset Values\"> ", row_value[13]);
printf(" </CENTER> </FORM> <P> <CENTER> </BODY> </HTML> ");
/*Set up the delete option on web page*/
printf(" <CENTER> <FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/delete2.cgi\" METHOD = POST>");
printf(" <input type=hidden name = pid value = %s>\n", argv[1]);
printf(" <INPUT TYPE=\"SUBMIT\" VALUE=\"DELETE REQUEST\"> ");
printf(" </CENTER> </FORM> ");
printf("</CENTER>\n");
printf("<HR>");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28\">Go Back to Main Admin Page</A>\n");
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
000001
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `approve_md $parameters{'pid'}`;
print <<"HTML";
<title>Approval/Modification Page</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H1>Approval/Modification Page</H1>
$output
<P>
</BODY>
HTML
056
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/4/96
Purpose: Take an pending room reservation and
print out in reservation request format.
This page will allow both approvals and
deletions of pending reservations.
Companion Code: approve_rs.cgi
**************************************************/
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Enter a Database query*/
sprintf(tmp_str, "select * from pending_queue where pid = %s", argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf(" <P><B> <FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/submit2.cgi\" METHOD = POST> ");
printf(" <center> <H2> Room Scheduling Request Form </H2> </center> <hr size=3> <P> ");
printf(" <input type=hidden name =\"pid\" value =%s>\n", row_value[0]);
printf(" <CODE><b> Requestor Name......</b></FONT></CODE> <INPUT NAME=\"name\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Email address.......</b></FONT></CODE> ", row_value[1]);
printf(" <INPUT NAME=\"email\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Title of the Event..</b></FONT></CODE> ", row_value[2]);
printf(" <INPUT NAME=\"title\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40 ><BR>", row_value[5]);
printf(" <CODE><b> Phone Number........</b></FONT></CODE> <INPUT NAME=\"phone\" VALUE=\"%s\" MAXLENGTH=60 SIZE=40> <BR>", row_value[3]);
printf(" <P><CODE><b>Position</b></FONT></CODE> <select NAME=\"position\">");
printf("<option selected>%s ", row_value[4]);
printf("<option> Student <option> Faculty <option> Other");
printf("</select>");
printf("<p> <code><b>Room to be reserved </b></font></code> ");
printf(" <select name=\"room\"> ");
printf(" <option selected value=\"%s\">%s", row_value[6], row_value[6]);
printf("<option value=\"AVW1112\">AVW1112 <option value=\"AVW1152\">AVW1152 <option value=\"AVW3258\">AVW3258 <option value=\"AVW4185\">AVW4185 <option value=\"Other\">Other </select> ");
printf(" <table><tr><td><code><b>Date...............</b></font></code><td> <select name=\"month\">");
switch (atoi(row_value[7])) {
case 1: {
printf(" <option selected value=1>January");
break;
}
case 2: {
printf(" <option selected value=2>Febuary");
break;
}
case 3: {
printf(" <option selected value=3>March");
break;
}
case 4: {
printf(" <option selected value=4>April");
break;
}
case 5: {
printf(" <option selected value=5>May");
break;
}
case 6: {
printf(" <option selected value=6>June");
break;
}
case 7: {
printf(" <option selected value=7>July");
break;
}
case 8: {
printf(" <option selected value=8>August");
break;
}
case 9: {
printf(" <option selected value=9>September");
break;
}
case 10: {
printf(" <option selected value=10>October");
break;
}
case 11: {
printf(" <option selected value=11>November");
break;
}
case 12: {
printf(" <option selected value=12>December");
break;
}
}
printf(" <option value=1>January <option value=2>February <option value=3>March ", row_value[7], row_value[7]);
printf(" <option value=4>April <option value=5>May <option value=6>June <option value=7>July <option value=8>August <option value=9>September ");
printf(" <option value=10>October <option value=11>November <option value=12>December</select> <td> <select name=\"day\"> <option selected>%s", row_value[8]);
printf("<option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11 <option>12 <option>13 <option>14 <option>15 <option>16 <option>17 <option>18 <option>19 <option>20 <option>21 <option>22 <option>23 <o
ption>24 <option>25 ");
printf(" <option>26 <option>27 <option>28 <option>29 <option>30 <option>31</select> <td> <select name=\"year\"> <option selected>%s <option>1996 <option >1997 <option >1998 <option >1999</select> ", row_value[9]);
printf(" </tr> </table> <table><tr> <td><code><b>Time...............</b></font></code> <td><select name=\"start_time\"> ");
printf(" <option selected value=%s>", row_value[10]);
switch (atoi(row_value[10])) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
}
printf(" <option value=800>8:00 AM <option value=830>8:30 AM <option value=900>9:00 AM ");
printf(" <option value=930>9:30 AM <option value=1000>10:00 AM <option value=1030>10:30 AM <option value=1100>11:00 AM <option value=1130>11:30 AM <option value=1200>12:00 PM <option value=1230>12:30 PM ");
printf(" <option value=1300>1:00 PM <option value=1330>1:30 PM <option value=1400>2:00 PM <option value=1430>2:30 PM <option value=1500>3:00 PM <option value=1530>3:30 PM <option value=1600>4:00 PM <option value=1630>4:30 PM <option value=1700>5:00 PM <o
ption value=1730>5:30 PM ");
printf(" <option value=\"1800\">6:00 PM</select> <td>To: <td><select name=\"end_time\">");
printf(" <option selected value=%s>", row_value[11]);
switch (atoi(row_value[11])) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
case 1830: {
printf("6:30 PM");
break;
}
}
printf(" <option value=\"830\">8:30 AM <option value=\"900\">9:00 AM <option value=\"930\">9:30 AM <option value=\"1000\">10:00 AM ");
printf(" <option value=\"1030\">10:30 AM <option value=\"1100\">11:00 AM <option value=\"1130\">11:30 AM <option value=\"1200\">12:00 PM <option value=\"1230\">12:30 PM <option value=\"1300\">1:00 PM <option value=\"1330\">1:30 PM <option value=\"1400\">
2:00 PM ");
printf(" <option value=\"1430\">2:30 PM <option value=\"1500\">3:00 PM <option value=\"1530\">3:30 PM <option value=\"1600\">4:00 PM <option value=\"1630\">4:30 PM <option value=\"1700\">5:00 PM <option value=\"1730\">5:30 PM <option value=\"1800\">6:00
PM ");
printf(" <option value=\"1830\">6:30 PM</select> </tr> </table> Link to the event web page (optional)<br> <INPUT NAME=\"linkto\" VALUE=\"%s\" MAXLENGTH=\"60\" SIZE=\"60\" ><BR> Or, Short description of the event<BR> ", row_value[12]);
printf(" <TEXTAREA NAME=\"description\" ROWS=3 COLS=50>%s</TEXTAREA> <BR> <hr size=2> <P><CENTER> <INPUT TYPE=\"SUBMIT\" VALUE=\"Approve\"> <INPUT TYPE=\"RESET\" VALUE=\"Reset Values\"> ", row_value[13]);
printf(" </CENTER> </FORM> ");
/*Set up the delete option on web page*/
printf(" <CENTER> <FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/delete1.cgi\" METHOD = POST>");
printf(" <input type=hidden name = pid value = %s>\n", argv[1]);
printf(" <INPUT TYPE=\"SUBMIT\" VALUE=\"DELETE REQUEST\"> ");
printf(" </CENTER> </FORM> ");
printf("<HR>");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28\">Go Back to Main Admin Page</A>\n");
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
*******
Author: John Messina
Last Modified Date: 5/4/96
Purpose: Take an pending room reservation and
print out in reservation request format.
This page will allow both approvals and
deletions of pending reservations.
Companion Code: approve_rs.cgi
**************************************************/
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
intapprove_rs.cgi
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$data_value = $parameters{'pid'};
$output = `approve_rs $parameters{'pid'}`;
print <<"HTML";
<title>Approval/Modification Page</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H1>Approval/Modification Page</H1>
<HR>
$output
<P>
</BODY>
HTML
64
#
# Auther: David Wang davewang@wam.umd.edu
# John Messina messina@speckle.ncsl.nist.gov
# Date: March 19, 1996
# Modified: April 20, 1996
#
# Program name: approve_sc.cgi
#
########################################################
# Let's create the associative array to find the value
# of the month.
########################################################
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$nextyear=$year+1;
# We find a numerical value representation of today's date.
$today_date = $year * 10000 + $value{$moy} * 100 +$tod;
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
###################################################
# CGI output: As HTML and as email to submitter
###################################################
# Create an html document on the fly.
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Search Engine on Approved Reservations</TITLE>
<!Author: David Wang. davewang@wam.umd.edu>
<!Author2: Modified by John Messina messina@speckle.ncsl.nist.gov>
<!Date: March 18, 1996>
</HEAD>
<BODY>
<P><B>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/search.cgi" METHOD = POST>
<INPUT NAME="MailTo" VALUE="web28@panache.cs.umd.edu" TYPE="hidden" >
<INPUT NAME="ResponseForm" VALUE="response.html" TYPE="hidden" >
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center>
<H2>Search Engine on Approved Reservations
</H2>
</center>
<hr size=3>
Instructions::
<BR>
This page will search through the list of approved reservations
looking for entries which match the values entered for the fields below.
Example: University Position set to Student will return all the approved
reservations requested by students.
<hr size=3>
<P>
<CODE><b> Requestor Name......</b></FONT></CODE>
<INPUT NAME="name" VALUE="" MAXLENGTH="80" SIZE="45" ><BR>
<CODE><b> Email address.......</b></FONT></CODE>
<INPUT NAME="email" VALUE="" MAXLENGTH="60" SIZE="45" ><BR>
<CODE><b> Title of the Event..</b></FONT></CODE>
<INPUT NAME="title" VALUE="" MAXLENGTH="60" SIZE="45" ><BR>
<code><b>University Position</b></font></code>
<select name="position">
<option selected>
<option value="Student">Student
<option value="Faculty">Faculty
<option value="Other">Other</select>
<code><b>Room to be reserved </b></font></code>
<select name="room">
<option selected>
<option value="AVW1112">AVW1112
<option value="AVW1152">AVW1152
<option value="AVW3258">AVW3258
<option value="AVW4185">AVW4185
<option value="Other">Other</select>
<table><tr><td><code><b>Date...............</b></font></code><td>
Month
<select name="month">
<option selected>
<option value=1>Jan
<option value=2>Feb
<option value=3>Mar
<option value=4>Apr
<option value=5>May
<option value=6>Jun
<option value=7>Jul
<option value=8>Aug
<option value=9>Sep
<option value=10>Oct
<option value=11>Nov
<option value=12>Dec</select>
<td>Day
<select name="day">
<option selected>
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31</select>
<td>
Year
<select name="year">
<option selected>
<option value="$year">$year
<option value="$nextyear">$nextyear</select>
</tr>
</table>
<hr size=2>
<P><CENTER>
<INPUT TYPE="SUBMIT" VALUE="Search">
<INPUT TYPE="RESET" VALUE="Reset Values">
</CENTER>
</FORM>
<HR>
<A HREF="http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html">Go Back to Main Admin Page</A>
</BODY>
</HTML>
HTML
#include "/panache/web30/Minerva/include/msql.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
#define TIME_SLOT 22
#define NUM_ROOM 6
#define ROOM1 "AVW1112"
#define ROOM2 "AVW1152"
#define ROOM3 "AVW3258"
#define ROOM4 "AVW4185"
#define OTHER "Other"
typedef struct _node{
int pid;
int duration;
char title[128];
} node;
int next_year(m, d, y)
int m;
int d;
int y;
{
if ((m==12)&&(d==31)) return (y+1);
else return y;
}
int next_month(m, d, y)
int m;
int d;
int y;
{
if (((m==1)||(m==3)||(m==5)||(m==7)||(m==8)||(m==10)||(m==12))&&(d==31))
return ((m+1)%12);
else if (((m==4)||(m==6)||(m==9)||(m==11))&&(d==30))
return (m+1);
else if ((m==2)&&(d==28)) /* don't include 2004 */
return (m+1);
else
return m;
}
int next_day(m, d, y)
int m;
int d;
int y;
{
if (((m==1)||(m==3)||(m==5)||(m==7)||(m==8)||(m==10)||(m==12))&&(d==31))
return 1;
else if (((m==4)||(m==6)||(m==9)||(m==11))&&(d==30))
return 1;
else if ((m==2)&&(d==28)) /* don't include 2004 */
return 1;
else
return (d+1);
}
int pre_year ( m, d, y)
int m;
int d;
int y;
{
if ((m==1)&&(d==1)) return (y-1);
else return y;
}
int pre_month(m, d, y)
int m;
int d;
int y;
{
if ((m==1)&&(d==1))
return 12;
else if (d==1)
return (m-1);
else
return m;
}
int pre_day(m, d, y)
int m;
int d;
int y;
{ /* don't include 2004 */
if (((m==1)||(m==2)||(m==4)||(m==6)||(m==8)||(m==9)||(m==11))&&(d==1))
return 31;
else if (((m==5)||(m==7)||(m==10)||(m==12))&&(d==1))
return 30;
else if ((m==3)&&(d==1))
return 28;
else return (d-1);
}
main(argc, argv)
int argc;
char* argv[];
{
node schedule_matrix[TIME_SLOT][NUM_ROOM];
char* ip_addr = "panache.cs.umd.edu";
char* database = "cs_room";
char* query1 = "select pid, title, room, start_time, end_time from approved where ";
char * query;
char* status;
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i,j;
int r;
int st;
int et;
m_field *field_value;
m_result *q_result;
m_row row_value;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
putenv("MSQL_TCP_PORT=10000");
putenv("MSQL_HOME=/panache/web30/Minerva");
for (i=0; i<TIME_SLOT; i++)
for (j=0; j<NUM_ROOM; j++)
{
schedule_matrix[i][j].pid = 0;
schedule_matrix[i][j].duration=0;
}
schedule_matrix[0][0].pid = -2;
schedule_matrix[1][0].pid = -2;
schedule_matrix[2][0].pid = -2;
schedule_matrix[3][0].pid = -2;
schedule_matrix[4][0].pid = -2;
schedule_matrix[5][0].pid = -2;
schedule_matrix[6][0].pid = -2;
schedule_matrix[7][0].pid = -2;
schedule_matrix[8][0].pid = -2;
schedule_matrix[9][0].pid = -2;
schedule_matrix[10][0].pid = -2;
schedule_matrix[11][0].pid = -2;
schedule_matrix[12][0].pid = -2;
schedule_matrix[13][0].pid = -2;
schedule_matrix[14][0].pid = -2;
schedule_matrix[15][0].pid = -2;
schedule_matrix[16][0].pid = -2;
schedule_matrix[17][0].pid = -2;
schedule_matrix[18][0].pid = -2;
schedule_matrix[19][0].pid = -2;
schedule_matrix[20][0].pid = -2;
schedule_matrix[21][0].pid = -2;
/*
status=strcpy(schedule_matrix[0][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=800&month=%s&day=%s&year=%s\">8:00 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[1][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=830&month=%s&day=%s&year=%s\">8:30 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[2][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=900&month=%s&day=%s&year=%s\">9:00 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[3][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=930&month=%s&day=%s&year=%s\">9:30 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[4][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1000&month=%s&day=%s&year=%s\">10:00 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[5][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1030&month=%s&day=%s&year=%s\">10:30 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[6][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1100&month=%s&day=%s&year=%s\">11:00 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[7][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1130&month=%s&day=%s&year=%s\">11:30 AM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[8][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1200&month=%s&day=%s&year=%s\">12:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[9][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1230&month=%s&day=%s&year=%s\">12:30 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[10][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1300&month=%s&day=%s&year=%s\">1:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[11][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1330&month=%s&day=%s&year=%s\">1:30 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[12][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1400&month=%s&day=%s&year=%s\">2:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[13][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1430&month=%s&day=%s&year=%s\">2:30 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[14][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1500&month=%s&day=%s&year=%s\">3:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[15][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1530&month=%s&day=%s&year=%s\">3:30 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[16][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1600&month=%s&day=%s&year=%s\">4:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[17][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1630&month=%s&day=%s&year=%s\">4:30 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[18][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1700&month=%s&day=%s&year=%s\">5:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[19][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1730&month=%s&day=%s&year=%s\">5:30 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[20][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1800&month=%s&day=%s&year=%s\">6:00 PM</A>", argv[1], argv[2], argv[3]);
status=strcpy(schedule_matrix[21][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1830&month=%s&day=%s&year=%s\">6:30 PM</A>", argv[1], argv[2], argv[3]);
*/
sprintf(schedule_matrix[0][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=800&month=%s&day=%s&year=%s\">8:00 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[1][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=830&month=%s&day=%s&year=%s\">8:30 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[2][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=900&month=%s&day=%s&year=%s\">9:00 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[3][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=930&month=%s&day=%s&year=%s\">9:30 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[4][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1000&month=%s&day=%s&year=%s\">10:00 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[5][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1030&month=%s&day=%s&year=%s\">10:30 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[6][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1100&month=%s&day=%s&year=%s\">11:00 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[7][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1130&month=%s&day=%s&year=%s\">11:30 AM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[8][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1200&month=%s&day=%s&year=%s\">12:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[9][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1230&month=%s&day=%s&year=%s\">12:30 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[10][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1300&month=%s&day=%s&year=%s\">1:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[11][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1330&month=%s&day=%s&year=%s\">1:30 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[12][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1400&month=%s&day=%s&year=%s\">2:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[13][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1430&month=%s&day=%s&year=%s\">2:30 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[14][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1500&month=%s&day=%s&year=%s\">3:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[15][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1530&month=%s&day=%s&year=%s\">3:30 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[16][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1600&month=%s&day=%s&year=%s\">4:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[17][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1630&month=%s&day=%s&year=%s\">4:30 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[18][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1700&month=%s&day=%s&year=%s\">5:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[19][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1730&month=%s&day=%s&year=%s\">5:30 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[20][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1800&month=%s&day=%s&year=%s\">6:00 PM</A>", argv[1], argv[2], argv[3]);
sprintf(schedule_matrix[21][0].title, "<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1830&month=%s&day=%s&year=%s\">6:30 PM</A>", argv[1], argv[2], argv[3]);
printf("<H1>Computer Science Department Room Schedule </H1>\n");
if (argv[1] == NULL)
{
printf("<h1> A value for month is required </h1>");
exit(0);
}
else
{
query = strcat(query1,"month=");
query = strcat(query1,argv[1]);
query = strcat(query," ");
};
if (argv[2] == NULL)
{
printf("<h1> A value for day is required </h1>");
exit(0);
}
else
{
query = strcat(query1,"and day=");
query = strcat(query1,argv[2]);
query = strcat(query," ");
};
if (argv[3] == NULL)
{
printf("<h1> A value for year is required </h1>");
exit(0);
}
else
{
query = strcat(query1,"and year=");
query = strcat(query1,argv[3]);
query = strcat(query," ");
};
printf("<H2> For the day of %s-%s-%s</H2>\n",argv[1], argv[2],argv[3]);
socket_value = msqlConnect(ip_addr);
/*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the Database to be accessed*/
return_value = msqlSelectDB(socket_value, database);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Enter a Database query*/
return_value = msqlQuery(socket_value, query);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Store the value of the query*/
q_result = msqlStoreResult();
if (msqlNumRows(q_result) != 0)
{
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
while (row_value != NULL) {
if (strcmp(row_value[2],ROOM1)==0)
r=1;
else if (strcmp(row_value[2],ROOM2)==0)
r=2;
else if (strcmp(row_value[2],ROOM3)==0)
r=3;
else if (strcmp(row_value[2],ROOM4)==0)
r=4;
else
r=5;
st = ceil((atoi(row_value[3]) - 800 )*2.0 /100);
et = ceil((atoi(row_value[4]) - 800 )*2.0 /100);
schedule_matrix[st][r].pid=atoi(row_value[0]);
status=strcpy(schedule_matrix[st][r].title,row_value[1]);
schedule_matrix[st][r].duration=ceil((atoi(row_value[4])-atoi(row_value[3]))*2.0/100);
for (j=st+1; j<et; j++)
schedule_matrix[j][r].pid=-1;
row_value = msqlFetchRow(q_result);
}
}
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
printf("<center>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi?month=%d&day=%d&year=%d\">\n<IMG align=bottom SRC =\"../images/larrow.jpg alt=Previous_day\"></A>\n", pre_month(atoi(argv[1]),atoi(argv[2]),atoi(argv[3])), pre_day(atoi(argv[1]),a
toi(argv[2]),atoi(argv[3])), pre_year(atoi(argv[1]),atoi(argv[2]),atoi(argv[3])));
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi?month=%d&day=%d&year=%d\">\n<IMG align=bottom SRC =\"../images/rarrow.jpg alt=Next_day\"> </A>\n", next_month(atoi(argv[1]),atoi(argv[2]),atoi(argv[3])), next_day(atoi(argv[1]),at
oi(argv[2]),atoi(argv[3])), next_year(atoi(argv[1]),atoi(argv[2]),atoi(argv[3])));
printf("</center>\n");
printf("<table BORDER width=80%% cols=6>\n");
printf("<th>Time\n");
printf("<th><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_rm.cgi?room=%s&month=%s&day=%s&year=%s\"> AVW1112 </A>\n",ROOM1, argv[1], argv[2], argv[3]);
printf("<th><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_rm.cgi?room=%s&month=%s&day=%s&year=%s\"> AVW1152 </A>\n",ROOM2, argv[1], argv[2], argv[3]);
printf("<th><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_rm.cgi?room=%s&month=%s&day=%s&year=%s\"> AVW3258 </A>\n",ROOM3, argv[1], argv[2], argv[3]);
printf("<th><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/request_rm.cgi?room=%s&month=%s&day=%s&year=%s\"> AVW4185 </A>\n",ROOM4, argv[1], argv[2], argv[3]);
printf("<th>Other\n");
for (i=0; i<TIME_SLOT; i++)
{
printf("<tr valign=middle align=Center>");
for (j=0; j<NUM_ROOM; j++)
{
if (schedule_matrix[i][j].pid>0)
{
printf("<td rowspan=%d>",schedule_matrix[i][j].duration);
printf("<a href=http://panache.cs.umd.edu:8080/~web28/room/cgi/detail.cgi?pid=%d>",schedule_matrix[i][j].pid);
printf(schedule_matrix[i][j].title);
printf("</a>");
}
else if (schedule_matrix[i][j].pid==0)
{
printf("<td>.");
}
else if (schedule_matrix[i][j].pid==-2)
{
printf("<td>");
printf("%s", schedule_matrix[i][j].title);
}
}
printf("</tr>\n");
}
printf("</table>\n");
}
nache.cs.umd.edu:8080/~web28/room/cgi/request_hr.cgi?start_time=1830&month=%s&day=%s&year=%s\">6:30 PM</A>", argv[1], argv[2], argv[3]);
*/
sprintf(scheduleavail.cgi
# By Terry Lam
#
# figure out what today's date is
require "cgi-utils.pl";
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
$value{1}="Jan";
$value{2}="Feb";
$value{3}="Mar";
$value{4}="Apr";
$value{5}="May";
$value{6}="Jun";
$value{7}="Jul";
$value{8}="Aug";
$value{9}="Sep";
$value{10}="Oct";
$value{11}="Nov";
$value{12}="Dec";
%parameters = &get_query;
$nextyear=$parameters{'year'}+1;
$req_d_m=$parameters{'month'}*100+$parameters{'day'};
if (($req_d_m==230)||($req_d_m==231)||($req_d_m==431)||($req_d_m==631)||
($req_d_m==931)||($req_d_m==1131)||($req_d_m==229)){
print <<"HTML";
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center><H1>Sorry,</H1></center><hr>
<h2>You've searched a day which does not exist.
Please enter a valid date</h2>
</body>
</html>
HTML
}
else
{
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Computer Science Department Room Schedule</TITLE>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center>
HTML
$output = `avail $parameters{'month'} $parameters{'day'} $parameters{'year'}`;
print $output;
print <<"HTML";
</center>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi" METHOD="POST">
<center>
<table><tr>
<td>
<select name="month">
<option selected value="$parameters{'month'}">$value{$parameters{'month'}}
<option value=1>Jan
<option value=2>Feb
<option value=3>Mar
<option value=4>Apr
<option value=5>May
<option value=6>Jun
<option value=7>Jul
<option value=8>Aug
<option value=9>Sep
<option value=10>Oct
<option value=11>Nov
<option value=12>Dec</select>
<td>
<select name="day">
<option selected value="$parameters{'day'}">$parameters{'day'}
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31</select>
<td>
<select name="year">
<option selected value="$parameters{'year'}">$parameters{'year'}
<option value="$nextyear">$nextyear</select>
</tr>
</table>
</center>
<CENTER>
<INPUT TYPE="SUBMIT" VALUE="Search">
<INPUT TYPE="RESET" VALUE="Clear">
</CENTER>
</FORM>
<HR><A HREF="../../">Go Back to Main Page</A>
</BODY>
</HTML>
HTML
}
# By Terry Lam
#Print this out no matter what.
require "cgi-utils.pl";
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 + $value{$moy} * 100 +$dom;
$nextyear=$year+1;
$today_date = $year * 10000 + $value{$moy} * 100 +$tod;
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Computer Science Department Room Schedule</TITLE>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center>
HTML
$output = `/panache/web28/public_html/room/cgi/avail $value{$moy} $dom $year `;
print $output;
print <<"HTML";
</center>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi" METHOD="POST">
<center>
<table><tr>
<td>
<select name="month">
<option selected value="$value{$moy}">$moy
<option value=1>Jan
<option value=2>Feb
<option value=3>Mar
<option value=4>Apr
<option value=5>May
<option value=6>Jun
<option value=7>Jul
<option value=8>Aug
<option value=9>Sep
<option value=10>Oct
<option value=11>Nov
<option value=12>Dec</select>
<td>
<select name="day">
<option selected value="$dom">$dom
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31</select>
<td>
<select name="year">
<option selected value="$year">$year
<option value="$nextyear">$nextyear</select>
</tr>
</table>
</center>
<P><CENTER>
<INPUT TYPE="SUBMIT" VALUE="Search">
<INPUT TYPE="RESET" VALUE="Clear">
</CENTER>
</FORM>
<HR><A HREF="../../">Go Back to Main Page</A>
</BODY>
</HTML>
HTML
md.edu:8080/~web28/room/cgi/avail.cgi" METHOD="POST">
<center>
<table><tr>
<td>
<select name="month">
<option seleavailold.cgi
# By Terry Lam
require "cgi-utils.pl";
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
%parameters = &get_query;
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Computer Science Department Room Schedule</TITLE>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center>
HTML
$output = `avail $parameters{'month'} $parameters{'day'} $parameters{'year'}`;
print $output;
print <<"HTML";
</center>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi" METHOD="P
OST">
<center>
<table><tr>
<td>
<select name="month">
<option selected value=1>January
<option value=2>February
<option value=3>March
<option value=4>April
<option value=5>May
<option value=6>June
<option value=7>July
<option value=8>August
<option value=9>September
<option value=10>October
<option value=11>November
<option value=12>December</select>
<td>
<select name="day">
<option selected value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31</select>
<td>
<select name="year">
<option selected value="1996">1996
<option value="1997">1997
<option value="1998">1998
<option value="1999">1999</select>
</tr>
</table>
</center>
<P><CENTER>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Clear">
</CENTER>
</FORM>
</BODY>
</HTML>
HTML
#
# Auther: David Wang davewang@wam.umd.edu
# Date: April 27, 1996
# Program name: bulletin.cgi
#
# This is the perl script which access the bulletin and
# spews out a page for it.
#
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
# Create an html document on the fly.
$output = `/usr/local/bin/bull`;
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Bulletin board announcements</TITLE>
<!Author: David Wang. davewang@wam.umd.edu>
<!Date: April 27, 1996>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<pre>
$output
</pre>
</BODY>
</HTML>
HTML
004564
# By Terry Lam
#Print this out no matter what.
require "cgi-utils.pl";
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 + $value{$moy} * 100 +$dom;
$nextyear=$year+1;
$today_date = $year * 10000 + $value{$moy} * 100 +$tod;
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Computer Science Department Room Schedule</TITLE>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center>
HTML
$output = `/panache/web28/public_html/room/cgi/avail $value{$moy} $dom $year `;
print $output;
print <<"HTML";
</center>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi" METHOD="POST">
<center>
<table><tr>
<td>
<select name="month">
<option selected value="$value{$moy}">$moy
<option value=1>Jan
<option value=2>Feb
<option value=3>Mar
<option value=4>Apr
<option value=5>May
<option value=6>Jun
<option value=7>Jul
<option value=8>Aug
<option value=9>Sep
<option value=10>Oct
<option value=11>Nov
<option value=12>Dec</select>
<td>
<select name="day">
<option selected value="$dom">$dom
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31</select>
<td>
<select name="year">
<option selected value="$year">$year
<option value="$nextyear">$nextyear</select>
</tr>
</table>
</center>
<P><CENTER>
<INPUT TYPE="SUBMIT" VALUE="Search">
<INPUT TYPE="RESET" VALUE="Clear">
</CENTER>
</FORM>
<HR><A HREF="../../">Go Back to Main Page</A>
</BODY>
</HTML>
HTML
# Author: David Wang davewang@wam.umd.edu
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
#How many bytes are we supposed to receive?
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$buffer);
foreach $pair (@pairs)
{
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$contents{$name} = $value;
}
}
#
#
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
($dow,$req_moy,$dom,$tod,$timezone,$req_year)=split(/ +/,`date`);
# Create an html document on the fly.
print <<"HTML";
<html>
<head>
<title>This is the reply page</title>
</head>
<body>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center><h1>Please Select the date that you wish to view</h1></center>
<hr>
HTML
for($loop=1;$loop<3;$loop++){
if($loop==1){
$moy=$value{$req_moy};$year=$req_year;
}
else{
if($req_moy==12){
$moy=1;$year=$req_year+1;
}
else{
$moy=$value{$req_moy}+1;$year=$req_year;
}
}
@line=split(/\n/,`cal $moy $year`);
$a=@line;
for($i=0;$i<$a;$i++){
if($i==0){
print<<"HTML";
<center>
<table><tr><td colspan=7>
<center><h2>$line[0]</h2></center></tr>
HTML
}
elsif($i==1){
print<<"HTML";
<tr>
HTML
@line1=split(/ +/,$line[1]);
for($j=1;$j<=7;$j++){
print<<"HTML";
<td>$line1[$j]
HTML
}
print<<"HTML";
</tr>
HTML
}
elsif($i==2){
print<<"HTML";
<tr>
HTML
@line2=split(/ +/,$line[2]);
$count=@line2;
if($count==8){
for($j=1;$j<8;$j++){
print<<"HTML";
<td><A HREF="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi?month=$moy
&day=$line2[$j]&year=$year">$line2[$j]
HTML
}
}
else{
for($j=0;$j<(7-$count);$j++){
print<<"HTML";
<td>
HTML
}
for($j=0;$j<$count;$j++){
print<<"HTML";
<td><A HREF="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi?month=$moy&day=$line2[$j]&year=$year">$line2[$j]
HTML
}
}
print<<"HTML";
</tr>
HTML
}
elsif($i>2){
print<<"HTML";
<tr>
HTML
@linei=split(/ +/,$line[$i]);
$count=@linei;
if($count==8){
for($j=1;$j<8;$j++){
print<<"HTML";
<td><A HREF="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi?month=$moy&day=$linei[$j]&year=$year">$linei[$j]
HTML
}
print<<"HTML";
</tr>
HTML
}
else{
for($j=0;$j<$count;$j++){
print<<"HTML";
<td><A HREF="http://panache.cs.umd.edu:8080/~web28/room/cgi/avail.cgi?month=$moy&day=$linei[$j]&year=$year">$linei[$j]
HTML
}
print<<"HTML";
</tr>
HTML
}
}
}
print<<"HTML";
</table>
</center>
HTML
}
print<<"HTML";
</body>
</html>
HTML
ar;
}
else{
if($req_moy==12){
$moy=1;$year=$req_year+1;
}
else{
$moy=$value{$req_moy}+1;$year=$req_year;
}
}
@line=split(/\n/,`cal $moy $year`);
$a=@line;
for($i=0;$i<$a;$i++){
if($i==0){
print<<"HTML";
<center>
<table><tr><td colspan=7>
<center><h2>$line[0]</h2></center></tr>
HTML
}
elsif($i==1){
print<<"HTML";
<tr>
HTML
@line1=split(/ +/,$line[1]clean_db.cgi
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `clean_db`;
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$nextyear=$year+1;
# We find a numerical value representation of today's date.
$today_date = $year * 10000 + $value{$moy} * 100 +$tod;
#Print this out no matter what.
print <<"HTML";
<HEAD>
<title>Clean Database of Outdated Room Reservation Requests</title>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H1>Clean Database of Outdated Room Reservation Requests</H1>
<HR>
<H3>Instructions:</H3>
<H3>
This page will delete all entries both pending and approved
from the room reservation system from before the date selected. The
default date is today's date. This will remove any reservations prior
to today.
</H3>
<HR>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/clean_rq.cgi" METHOD = POST>
<B>Month</B>
<select name = "month">
<option selected value="$value{$moy}">$moy
<option value=1>Jan
<option value=2>Feb
<option value=3>Mar
<option value=4>Apr
<option value=5>May
<option value=6>Jun
<option value=7>Jul
<option value=8>Aug
<option value=9>Sep
<option value=10>Oct
<option value=11>Nov
<option value=12>Dec
</select>
<B>Day:</B>
<select name="day">
<option selected value="$dom">$dom
<option value=1>1
<option value=2>2
<option value=3>3
<option value=4>4
<option value=5>5
<option value=6>6
<option value=7>7
<option value=8>8
<option value=9>9
<option value=10>10
<option value=11>11
<option value=12>12
<option value=13>13
<option value=14>14
<option value=15>15
<option value=16>16
<option value=17>17
<option value=18>18
<option value=19>19
<option value=20>20
<option value=21>21
<option value=22>22
<option value=23>23
<option value=24>24
<option value=25>25
<option value=26>26
<option value=27>27
<option value=28>28
<option value=29>29
<option value=30>30
<option value=31>31
</select>
<B>Year:</B>
<select name="year">
<option selected value="$year">$year
<option value="$nextyear">$nextyear</select>
</select>
<P><LEFT>
<INPUT TYPE="SUBMIT" VALUE="Clean Database">
<INPUT TYPE="RESET" VALUE="Reset Date">
</LEFT>
</FORM>
<HR>
<A HREF="http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html">
Go Back to Main Admin Page</A>
HTML
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/4/96
Purpose: Clean the datebase of all
Impovements: Add a feature to delete a specific
day.
Companion Code: approve_rs.cgi
**************************************************/
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[335];
char tmp_str2[335];
int counter = 1;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL);
if (socket_value == -1) {
printf("Connection to Database failed\n");
return;
}
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*First delete all values from a previous year*/
/*delete from approved*/
sprintf(tmp_str, "delete from approved where year < %s", argv[3]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Approved Year Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
/*delete from pending*/
sprintf(tmp_str, "delete from pending_queue where year < %s", argv[3]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Pending Year Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
/*Second delete all values from this year and previous months*/
/*delete from approved*/
sprintf(tmp_str, "delete from approved where year = %s and month < %s", argv[3], argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Approved Year/Month Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
/*delete from pending*/
sprintf(tmp_str, "delete from pending_queue where year = %s and month < %s", argv[3], argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Pending Year/Month Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
/*Third delete all values from this year, month, and previous date*/
/*delete from approved*/
sprintf(tmp_str, "delete from approved where year = %s and month = %s and day < %s", argv[3], argv[1], argv[2]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Approved Year/Month/Day Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
/*delete from pending*/
sprintf(tmp_str, "delete from pending_queue where year = %s and month = %s and day < %s", argv[3], argv[1], argv[2]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Approved Year/Month/Day Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
printf("<BODY>");
printf("<H1>Database Cleaning Successful</H1>");
printf("<P>\n");
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>\n");
msqlClose(socket_value);
}
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `clean_rq '$parameters{'month'}' '$parameters{'day'}' '$parameters{'year'}' `;
print <<"HTML";
<title>Cleaning Database Status Page</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H1>Cleaning Database Status Page</H1>
$output
<P>
</BODY>
HTML
#include <stdio.h>
#include <string.h>
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[335];
char tmp_str2[335];
int counter = 1;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL);
if (socket_value == -1) {
printf("Connection to Database failed\n");
return;
}
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
sprintf(tmp_str, "delete from pending_queue where pid = %s", argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Room Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
printf("</BODY>\n");
msqlClose(socket_value);
return;
}
printf("<BODY>");
printf("<H1>Room Request Deletion Successful</H1>");
printf("<P>\n");
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back To Main Admin Page</A>");
printf("</BODY>\n");
msqlClose(socket_value);
}
24
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `delete1 '$parameters{'pid'}'`;
print <<"HTML";
<title>Status Page</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000"><HR>
$output
<P>
</BODY>
HTML
#include <stdio.h>
#include <string.h>
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[335];
char tmp_str2[335];
int counter = 1;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL);
if (socket_value == -1) {
printf("Connection to Database failed\n");
return;
}
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
sprintf(tmp_str, "delete from approved where pid = %s", argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Room Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
msqlClose(socket_value);
return;
}
printf("<BODY>");
printf("<H1>Room Request Deletion Successful</H1>");
printf("<BR>");
printf("Do you wish to send email notification of reservation change?", argv[1], argv[2]);
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/email_notice.cgi\" METHOD = POST>");
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", argv[14]);
printf("<INPUT NAME=\"status\" VALUE=3 TYPE=\"hidden\">");
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"Send Email Notification\">");
printf("</FORM>\n");
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>\n");
msqlClose(socket_value);
}
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$data_value = $parameters{'pid'};
$output = `delete2 '$parameters{'pid'}'`;
print <<"HTML";
<title>Status Page</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000"><HR>
$output
<P>
</BODY>
HTML
0100644
#include <stdio.h>
#include <string.h>
#include <math.h>
typedef struct _node{
int pid;
int duration;
char title[128];
} node;
main(argc, argv)
int argc;
char* argv[];
{
char* ip_addr = "panache.cs.umd.edu";
char* database = "cs_room";
char* query1 = "select * from approved where ";
char * query;
char* status;
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i,j;
int r;
int st;
int et;
m_field *field_value;
m_result *q_result;
m_row row_value;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
putenv("MSQL_TCP_PORT=10000");
putenv("MSQL_HOME=/panache/web30/Minerva");
printf("<H1>Details Information</H1>\n");
if (argv[1] == NULL)
{
printf("<h1> Application Error: Contact the Webmaster. </h1>");
exit(0);
}
else
{
query = strcat(query1,"pid=");
query = strcat(query1,argv[1]);
query = strcat(query," ");
};
socket_value = msqlConnect(ip_addr);
/*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the Database to be accessed*/
return_value = msqlSelectDB(socket_value, database);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Enter a Database query*/
return_value = msqlQuery(socket_value, query);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Store the value of the query*/
q_result = msqlStoreResult();
if (msqlNumRows(q_result) != 0)
{
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf("<TABLE BORDER=2 width=50%% CELLPADDING=2 CELLSPACING=2>\n");
/*Identify the number of fields in the table*/
num_fields = msqlNumFields(q_result);
/*print out the tables field names*/
for (i = 0; i < num_fields; i++) {
printf("<TR>\n");
field_value = msqlFetchField(q_result);
if (strcmp(field_value->name,"name")==0)
{
printf("<TD><b>%s</b></TD>", "Name");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"e_mail")==0)
{
printf("<TD><b>%s</b></TD>", "E-mail");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"phone")==0)
{
printf("<TD><b>%s</b></TD>", "Phone Number");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"position")==0)
{
printf("<TD><b>%s</b></TD>", "Position");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"title")==0)
{
printf("<TD><b>%s</b></TD>", "Title");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"room")==0)
{
printf("<TD><b>%s</b></TD>", "Room");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"month")==0)
{
printf("<TD><b> %s </b></TD>", "Date");
printf("<TD><pre> ");
printf("%s",row_value[i]);
field_value = msqlFetchField(q_result);
i++;
printf("-%s",row_value[i]);
field_value = msqlFetchField(q_result);
i++;
printf("-%s",row_value[i]);
printf(" </pre></TD></TR>\n");
}
else if (strcmp(field_value->name,"start_time")==0)
{
printf("<TD><b>%s</b></TD>", "Start Time");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"end_time")==0)
{
printf("<TD><b>%s</b></TD>", "End Time");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
else if (strcmp(field_value->name,"url_link")==0)
{
printf("<TD><b>%s</b></TD>", "URL Link");
if (row_value[i]!=NULL)
printf("<TD><pre> <a href=%s> %s </a> </pre></TD>",row_value[i],row_value[i]);
else
printf("<TD><pre> . </pre></TD>",row_value[i],row_value[i]);
}
else if (strcmp(field_value->name,"description")==0)
{
printf("<TD><b>%s</b></TD>", "Event Description");
printf("<TD><pre> %s </pre></TD></TR>\n", row_value[i]);
}
}
printf("</TABLE>\n");
}
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
l.cgi
ar
usr/imports/bin/perl
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$data_value = $parameters{'pid'};
$output = `detail '$parameters{'pid'}'`;
print <<"HTML";
<title></title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000"><HR>
$output
<P>
</BODY>
HTML
1
#include <stdio.h>
#include <string.h>
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
FILE *fopen(), *fp;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Enter a Database query*/
sprintf(tmp_str, "select * from approved where pid = %s", argv[1]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
/*Open temporary file to write email message content*/
fp = fopen("/var/tmp/email_notice", "w");
fprintf(fp, "CS Room Reservation Notification:\n\n");
switch (atoi(argv[2])) {
case 1: {
fprintf(fp, "Room Approval Notice:\n");
fprintf(fp, "\tReservation Information\n");
break;
}
case 2: {
fprintf(fp, "Room Modification Notice\n");
fprintf(fp, "\tReservation Information\n");
break;
}
case 3: {
fprintf(fp, "Room Deletion Notice\n");
fprintf(fp, "\tReservation Cancelation\n");
break;
}
}
fprintf(fp, "\n");
fprintf(fp, "Name: %s\n", row_value[1]);
fprintf(fp, "Email: %s\n", row_value[2]);
fprintf(fp, "Title: %s\n", row_value[5]);
fprintf(fp, "Room: %s\n", row_value[6]);
fprintf(fp, "Month: %s\n", row_value[7]);
fprintf(fp, "Day: %s\n", row_value[8]);
fprintf(fp, "Year: %s\n", row_value[9]);
fprintf(fp, "Start Time: %s\n", row_value[10]);
fprintf(fp, "End Time: %s\n", row_value[11]);
fclose(fp);
sprintf(tmp_str, "mail %s < /var/tmp/email_notice", row_value[2]);
system(tmp_str);
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/>Go Back to Main Admin Page</A>\n");
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
ice.cgi
0sisiyang
imports/bin/perl
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `email_notice '$parameters{'pid'}' '$parameters{'status'}`;
print <<"HTML";
<title>E-mail Notification Status Page</title>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000"><HR>
<H1>E-mail Notification Status Page</H1>
$output
<P>
</BODY>
HTML
6
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/5/96
Purpose: Print out a summary list of all room
reservations that have been submitted, but have
not yet been approved. Currently list is sorted
in no particular order.
Impovements: Add order by sql with room or date
Resize to make table format smaller
Re-order field names to show more
important information to the left.
Companion Code: pending_lt.cgi
**************************************************/
/*covert military time to standard time*/
void stantime(miltime)
int miltime;
{
switch (miltime) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
case 1830: {
printf("6:30 PM");
break;
}
}
}
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
/*set unix port to point to our copy of msql*/
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Enter a Database query*/
sprintf(tmp_str, "select pid, title, name, e_mail, phone, position, room, month, day, year, start_time, end_time, url_link from pending_queue order by room");
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
/* See if there are any results returned from the database*/
printf("<HR>\n");
if (msqlNumRows(q_result) != 0) {
/*Identify the number of fields in the table*/
num_fields = msqlNumFields(q_result);
printf("<TABLE BORDER>\n");
printf("<TR>\n");
/*print out the tables field names*/
for (i = 0; i < num_fields; i++) {
if (i == 0) { /*check for unque identifier*/
field_value = msqlFetchField(q_result);
printf("<TH></TH>");
} else {
field_value = msqlFetchField(q_result);
printf("<TH>%s</TH>", field_value->name);
}
}
printf("</TR>\n");
printf("\n");
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf("<TR>\n");
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_rs.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">",
row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 7) {
switch (atoi(row_value[i])) {
case 1: {
printf("<TD><PRE>January</PRE></TD>");
break;
}
case 2: {
printf("<TD><PRE>Febuary</PRE></TD>");
break;
}
case 3: {
printf("<TD><PRE>March</PRE></TD>");
break;
}
case 4: {
printf("<TD><PRE>April</PRE></TD>");
break;
}
case 5: {
printf("<TD><PRE>May</PRE></TD>");
break;
}
case 6: {
printf("<TD><PRE>June</PRE></TD>");
break;
}
case 7: {
printf("<TD><PRE>July</PRE></TD>");
break;
}
case 8: {
printf("<TD><PRE>August</PRE></TD>");
break;
}
case 9: {
printf("<TD><PRE>September</PRE></TD>");
break;
}
case 10: {
printf("<TD><PRE>October</PRE></TD>");
break;
}
case 11: {
printf("<TD><PRE>November</PRE></TD>");
break;
}
case 12: {
printf("<TD><PRE>December</PRE></TD>");
break;
}
}
} else if (i == 10) {
printf("<TD><PRE>\n");
stantime(atoi(row_value[i]));
printf("</PRE></TD>\n");
} else if (i == 11) {
printf("<TD><PRE>\n");
stantime(atoi(row_value[i]));
printf("</PRE></TD>\n");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\"><PRE>%s </PRE></A></TD>", row_value[i],
row_value[i]);
} else {
printf("<TD><PRE>%s </PRE></TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result);
printf("</TR>\n");
printf("\n");
}
printf("</TABLE>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back To Main Admin Page</A>\n");
} else {
printf("</TABLE>\n");
printf("<P><CENTER><H2>No Pending Requests Exist</H2></CENTER>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back To Main Admin Page</A>\n");
}
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `pending_lt`;
print <<"HTML";
<HEAD>
<title>List of Pending Room Reservation Requests</title>
</HEAD>
<BODY>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H1>List of Pending Room Reservation Requests</H1>
<HR>
<H3>Instructions:</H3>
Press the Select button to the left of the reservation listing
to go to the approval/modification page for the event.
<P>
$output
<P>
</BODY>
HTML
#
# Auther: David Wang davewang@wam.umd.edu
# John Messina messina@speckle.ncsl.nist.gov
# Date: March 19, 1996
# Modified: April 20, 1996
#
# Program name: request.cgi
#
# This is the perl script which outputs the form to be
# filled out by requesters. features not yet implemented
# include check for the requesting machine's subdomain
# it should end in .umd.edu, else send an apology form.
########################################################
# Let's create the associative array to find the value
# of the month.
########################################################
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$nextyear=$year+1;
# We find a numerical value representation of today's date.
$today_date = $year * 10000 + $value{$moy} * 100 +$tod;
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
###################################################
# CGI output: As HTML and as email to submitter
###################################################
# Create an html document on the fly.
print <<"HTML";
<HTML>
<HEAD>
<TITLE>Room scheduler </TITLE>
<!Author: David Wang. davewang@wam.umd.edu>
<!Author2: Modified by John Messina messina@speckle.ncsl.nist.gov>
<!Date: March 18, 1996>
</HEAD>
<BODY>
<P><B>
<FORM ACTION="http://panache.cs.umd.edu:8080/~web28/room/cgi/submit.cgi" METHOD = POST>
<INPUT NAME="MailTo" VALUE="web28@panache.cs.umd.edu" TYPE="hidden" >
<INPUT NAME="ResponseForm" VALUE="response.html" TYPE="hidden" >
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<center>
<H2> Room Scheduling Request Form
</H2>
</center>
<hr size=3>
<P>
<CODE><b> Requestor Name......</b></FONT></CODE>
<INPUT NAME="name" VALUE="" MAXLENGTH="80" SIZE="45" ><BR>
<CODE><b> Email address.......</b></FONT></CODE>
<INPUT NAME="email" VALUE="" MAXLENGTH="60" SIZE="45" ><BR>
<CODE><b> Title of the Event..</b></FONT></CODE>
<INPUT NAME="title" VALUE="" MAXLENGTH="60" SIZE="45" ><BR>
<CODE><b> Phone Number........</b></FONT></CODE>
<INPUT NAME="phone" VALUE="" MAXLENGTH="60" SIZE="45" ><BR>
<code><b>University Position</b></font></code>
<select name="position">
<option selected value="Student">Student
<option value="Faculty">Faculty
<option value="Other">Other</select>
<p>
<code><b>Room to be reserved </b></font></code>
<select name="room">
<option selected value="AVW1112">AVW 1112
<option value="AVW1152">AVW 1152
<option value="AVW3258">AVW 3258
<option value="AVW4185">AVW 4185
<option value="Other">Other</select>
<table><tr><td><code><b>Date...............</b></font></code><td>
<select name="month">
<option selected value="$value{$moy}">$moy
<option value=1>Jan
<option value=2>Feb
<option value=3>Mar
<option value=4>Apr
<option value=5>May
<option value=6>Jun
<option value=7>Jul
<option value=8>Aug
<option value=9>Sep
<option value=10>Oct
<option value=11>Nov
<option value=12>Dec</select>
<td>
<select name="day">
<option selected value="$dom">$dom
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15
<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31</select>
<td>
<select name="year">
<option selected value="$year">$year
<option value="$nextyear">$nextyear</select>
</tr>
</table>
<table><tr>
<td><code><b>Time...............</b></font></code>
<td><select name="start_time">
<option selected value="800">8:00 AM
<option value="830">8:30 AM
<option value="900">9:00 AM
<option value="930">9:30 AM
<option value="1000">10:00 AM
<option value="1030">10:30 AM
<option value="1100">11:00 AM
<option value="1130">11:30 AM
<option value="1200">12:00 PM
<option value="1230">12:30 PM
<option value="1300">1:00 PM
<option value="1330">1:30 PM
<option value="1400">2:00 PM
<option value="1430">2:30 PM
<option value="1500">3:00 PM
<option value="1530">3:30 PM
<option value="1600">4:00 PM
<option value="1630">4:30 PM
<option value="1700">5:00 PM
<option value="1730">5:30 PM
<option value="1800">6:00 PM</select>
<td>To:
<td><select name="end_time">
<option selected value="830">8:30 AM
<option value="900">9:00 AM
<option value="930">9:30 AM
<option value="1000">10:00 AM
<option value="1030">10:30 AM
<option value="1100">11:00 AM
<option value="1130">11:30 AM
<option value="1200">12:00 PM
<option value="1230">12:30 PM
<option value="1300">1:00 PM
<option value="1330">1:30 PM
<option value="1400">2:00 PM
<option value="1430">2:30 PM
<option value="1500">3:00 PM
<option value="1530">3:30 PM
<option value="1600">4:00 PM
<option value="1630">4:30 PM
<option value="1700">5:00 PM
<option value="1730">5:30 PM
<option value="1800">6:00 PM
<option value="1830">6:30 PM</select>
</tr>
</table>
Link to the event web page (optional)<br>
<INPUT NAME="linkto" VALUE="" MAXLENGTH="60" SIZE="60" ><BR>
Or, Short description of the event<BR>
<TEXTAREA NAME="description" ROWS=4 COLS=70></TEXTAREA>
<BR>
<hr size=2>
<P><CENTER>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Start Over">
</CENTER>
</FORM>
<P>
Thank you for taking the time to fill out this form.
<CENTER>
</BODY>
</HTML>
HTML
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `../cgi/submit5 '$parameters{'start_time'}' '$parameters{'month'}' '$parameters{'day'}' '$parameters{'year'}' `;
print "
<title>Room Scheduling Request Form</title>
<body>
<BODY BGCOLOR=\"#ffffff\" TEXT=\"#000000\">
";
print $output;
print "</body>";
print "<P>";
require "cgi-utils.pl";
%parameters = &get_query;
print "Content-type: text/html\x0A\x0A"; #signal to server -- i'm sending html
$output = `../cgi/submit4 '$parameters{'room'}' '$parameters{'month'}' '$parameters{'day'}' '$parameters{'year'}' `;
print "
<title>Room Scheduling Request Form</title>
<body>
<BODY BGCOLOR=\"#ffffff\" TEXT=\"#000000\">
";
print $output;
print "</body>";
print "<P>";
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/5/96
Purpose: print out any approved room reservations
based on a query search built by the
parameters entered on the approve_sc.cgi
page.
Companion Code: approve_sc.cgi
**************************************************/
void stanmonth (month)
int month;
{
switch (month) {
case 1: {
printf("<TD>January</TD>");
break;
}
case 2: {
printf("<TD>Febuary</TD>");
break;
}
case 3: {
printf("<TD>March</TD>");
break;
}
case 4: {
printf("<TD>April</TD>");
break;
}
case 5: {
printf("<TD>May</TD>");
break;
}
case 6: {
printf("<TD>June</TD>");
break;
}
case 7: {
printf("<TD>July</TD>");
break;
}
case 8: {
printf("<TD>August</TD>");
break;
}
case 9: {
printf("<TD>September</TD>");
break;
}
case 10: {
printf("<TD>October</TD>");
break;
}
case 11: {
printf("<TD>November</TD>");
break;
}
case 12: {
printf("<TD>December</TD>");
break;
}
}
}
/*covert military time to standard time*/
void stantime(miltime)
int miltime;
{
switch (miltime) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
case 1830: {
printf("6:30 PM");
break;
}
}
}
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i, first_flag = 1;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[525];
char tmp_str2[525];
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Generate a Database query*/
sprintf(tmp_str, "select pid, title, name, e_mail, phone, position, room, month, day, year, start_time, end_time, url_link from approved");
/*Check to see if there are any arguments to the search*/
if ((strcmp(argv[1], "") != 0) || (strcmp(argv[2], "") != 0) ||
(strcmp(argv[3], "") != 0) || (strcmp(argv[4], "") != 0) ||
(strcmp(argv[5], "") != 0) || (strcmp(argv[6], "") != 0) ||
(strcmp(argv[7], "") != 0) || (strcmp(argv[8], "") != 0)) {
sprintf(tmp_str2, " where ");
strcat(tmp_str, tmp_str2);
}
for (i = 1; i <= 8; i++) {
if (strcmp(argv[i], "") != 0) {
switch (i) {
case 1: {
sprintf(tmp_str2, " name LIKE '%s'", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 2: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " e_mail LIKE '%s'", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 3: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " position = '%s'", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 4: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " title LIKE '%s'", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 5: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " room = '%s'", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 6: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " month = %s", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 7: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " day = %s", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
case 8: {
if (!first_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " year = %s", argv[i]);
strcat(tmp_str, tmp_str2);
first_flag = 0;
break;
}
}
}
}
sprintf(tmp_str2, " order by room");
strcat(tmp_str, tmp_str2);
/*Enter the Database Query*/
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
if (msqlNumRows(q_result) != 0) {
/*Identify the number of fields in the table*/
num_fields = msqlNumFields(q_result);
printf("<H2>The Following Reservations Matched</H2>\n");
printf("<HR>\n");
printf("<TABLE BORDER>\n");
printf("<TR>\n");
/*print out the tables field names*/
for (i = 0; i < num_fields; i++) {
if (i == 0) { /*check for unque identifier*/
field_value = msqlFetchField(q_result);
printf("<TH></TH>");
} else {
field_value = msqlFetchField(q_result);
printf("<TH>%s</TH>", field_value->name);
}
}
printf("</TR>\n");
printf("\n");
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf("<TR>\n");
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_md.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">",
row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 7) {
stanmonth(atoi(row_value[i]));
} else if (i == 10) {
printf("<TD>");
stantime(atoi(row_value[i]));
printf("</TD>");
} else if (i == 11) {
printf("<TD>");
stantime(atoi(row_value[i]));
printf("</TD>");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\"><PRE>%s </PRE></A></TD>", row_value[i],
row_value[i]);
} else {
printf("<TD>%s</TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result);
printf("</TR>\n");
printf("\n");
}
printf("</TABLE>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
} else {
printf("<H2>No Reservations were found</H2>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
}
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
_flag) {
sprintf(tmp_str2, " and ");
strcat(tmp_str, tmp_str2);
}
sprintf(tmp_str2, " e_mail LIKE '%s'", argv[isearch.cgi
# Author: David Wang davewang@wam.umd.edu
# : John Messina
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
#How many bytes are we supposed to receive?
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$buffer);
foreach $pair (@pairs)
{
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$contents{$name} = $value;
}
}
#
# Create the associative array to find the value of the months.
#
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is, and a numerical representation
# of it.
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 + $value{$moy} * 100 +$dom;
#
# We find a numerical value representation of request date.
#
$req_date=$contents{'year'}*10000+$contents{'month'}*100+$contents{'day'};
#
# used to check for invalid date entires.
#
$req_d_m=$contents{'month'}*100+$contents{'day'};
#
# We use this to figure out whether the user entered in
# something too short to be valid in these crucial fields.
#
$_ =$contents{'name'};
$namelen = tr/a-zA-Z//;
$_ =$contents{'email'};
$emaillen = tr/a-zA-Z//;
$illegal = tr/\;\'\"\&//;
$_ =$contents{'title'};
$titlelen = tr/a-zA-Z//;
###################################################
# CGI output: As HTML and as email to submitter
###################################################
# Create an html document on the fly.
print <<"HTML";
<html>
<head>
<title>This is the reply page</title>
</head>
<body>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
HTML
#
#everything looks okay, search approved list.
#
print <<"HTML";
<h1>Search Results on Following Values</h1>
<p><hr><p>
<i>$moy $dom, $year</i>
<ul>
<li>Title of Event = $contents{'title'}
<li>Submitter Name = $contents{'name'}
<li>Email address = $contents{'email'}
<li>Room Requested = $contents{'room'}
<li>Position = $contents{'position'}
<li>Request Date = Month: $contents{'month'}, Day: $contents{'day'}, Year:$contents{'year'}
</ul>
HTML
#make the strings case-insensative
$contents{'name'} =~ s/([A-Za-z])/\[\L$1\U$1\]/gi;
$contents{'email'} =~ s/([A-Za-z])/\[\L$1\U$1\]/gi;
$contents{'title'} =~ s/([A-Za-z])/\[\L$1\U$1\]/gi;
$output = `search '$contents{'name'}' '$contents{'email'}' '$contents{'position'}' '$contents{'title'}' '$contents{'room'}' '$contents{'month'}' '$contents{'day'}' '$contents{'year'}'`;
print <<"HTML";
<hr>
$output
</body>
</html>
HTML
isiyang
"include/msql.h"
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <sys/types.h>
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_result *q_result2;
m_row row_value;
char tmp_str[335];
char tmp_str2[335];
int counter = 1;
/* datatypes need to get time of day*/
struct timeval tp;
struct timezone *tzp;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL);
if (socket_value == -1) {
printf("Connection to Database failed\n");
return;
}
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Get the time of day*/
gettimeofday(&tp, NULL);
sprintf(tmp_str, "insert into pending_queue values (%ld", tp.tv_sec );
while (counter <= 6) {
sprintf(tmp_str2, ", '%s'", argv[counter]);
strcat(tmp_str, tmp_str2);
counter++;
}
for (counter = 7; counter < 12; counter++) {
sprintf(tmp_str2, ", %s", argv[counter]);
strcat(tmp_str, tmp_str2);
}
for (counter = 12; counter <= 13; counter++) {
if (argv[counter] != NULL) {
sprintf(tmp_str2, ", '%s'", argv[counter]);
strcat(tmp_str, tmp_str2);
} else {
sprintf(tmp_str2, ", NULL");
strcat(tmp_str, tmp_str2);
}
}
strcat(tmp_str, ")");
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Room Request Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact secretary or Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
printf("</BODY>\n");
msqlClose(socket_value);
return;
}
printf("<BODY>");
/*1) see if an existing resverstion has an end time during time period*/
sprintf(tmp_str, "select * from approved where end_time <= %s and end_time > %s and year = %s and month = %s and day = %s and room = \'%s\' and room <> 'Other' ", argv[11], argv[10], argv[9], argv[7], argv[8], argv[6]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("2API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*1st query done. Now need to store results and do 2nd check*/
q_result = msqlStoreResult();
/*2) see if an existing resverstion totaly overlaps time period*/
sprintf(tmp_str, "select * from approved where start_time <= %s and end_time > %s and year = %s and month = %s and day = %s and room = \'%s\' and room <> 'Other'", argv[10], argv[11], argv[9], argv[7], argv[8], argv[6]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("3API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*2st query done*/
q_result2 = msqlStoreResult();
if ((msqlNumRows(q_result) != 0) || (msqlNumRows(q_result2) != 0)) {
printf("\n");
printf("<IT><h4>Please Note: This Room Reservation Conflicts with an already existing Room Reservation</h4></IT>");
}
printf("You will be contacted by email when your request \n");
printf("has been approved\n");
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/cgi-bin/request.cgi\">Go Back to Room Reservation Page</A>");
printf("</BODY>\n");
msqlClose(socket_value);
}
", NULL");
strcat(tmp_str, tmp_str2);
}
}
strcat(tmp_str, ")");
return_value = msqlQuery(socket_value, tmp_str);
if (return_valusubmit.cgi
# Author: David Wang davewang@wam.umd.edu
# : John Messina
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
#How many bytes are we supposed to receive?
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$buffer);
foreach $pair (@pairs)
{
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$contents{$name} = $value;
}
}
#
# Create the associative array to find the value of the months.
#
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is, and a numerical representation
# of it.
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 + $value{$moy} * 100 +$dom;
#
# We find a numerical value representation of request date.
#
$req_date=$contents{'year'}*10000+$contents{'month'}*100+$contents{'day'};
#
# used to check for invalid date entires.
#
$req_d_m=$contents{'month'}*100+$contents{'day'};
#
# We use this to figure out whether the user entered in
# something too short to be valid in these crucial fields.
#
$_ =$contents{'name'};
$namelen = tr/a-zA-Z//;
$_ =$contents{'email'};
$emaillen = tr/a-zA-Z//;
$illegal = tr/\;\'\"\&//;
$_ =$contents{'title'};
$titlelen = tr/a-zA-Z//;
###################################################
# CGI output: As HTML and as email to submitter
###################################################
# Create an html document on the fly.
print <<"HTML";
<html>
<head>
<title>This is the reply page</title>
</head>
<body>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
HTML
#check to make sure that end time is later than start time.
if ( $contents{'start_time'} >= $contents{'end_time'}) {
print <<"HTML";
<center><h1>Sorry, $contents{'name'}<h1></center>
<hr><h2>You've entered an invalid time.
please try again</h2>
</body>
</html>
HTML
}
#
#date entered was in past
#
elsif ( $today_date > $req_date ) {
print <<"HTML";
<center><h1>Sorry, $contents{'name'}<h1></center><hr>
<h2>You've entered an invalid date. please try again</h2>
<br>Month = $contents{'month'}
<br>Day = $contents{day}
<br>year = $contents{year}
<br>today_date = $today_date
<br>req_date = $req_date
</body>
</html>
HTML
}
# check for exceptions, all dates listed below are illegal.
# Feb 29 is also declared illegal, because there won't be a
# leap year until the year 2004
elsif (($req_d_m==230)||($req_d_m==231)||($req_d_m==431)||($req_d_m==631)||
($req_d_m==931)||($req_d_m==1131)||($req_d_m==229)){
print <<"HTML";
<center><H1>Sorry, $contents{'name'}</H1></center><hr>
<h2>You've scheduled a meeting on a day which does not exist.
Please enter a valid date</h2>
</body>
</html>
HTML
}
# if some crucial fields are left blank
# return error message
#
elsif($namelen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You've entered in an invalid name<br>
Please enter a valid name</h2>
</body>
</html>
HTML
}
elsif($illegal>0){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>Your email address is an unusual one, we cannot accept it<br>
Could you please enter a different email address?<br>
</body>
</html>
HTML
}
elsif($emaillen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You didn't enter an invalid email address<br>
Please enter a valid email address</h2>
</body>
</html>
HTML
}
elsif($titlelen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You've entered in an invalid title for this meeting <br>
Please enter a valid title</h2>
</body>
</html>
HTML
}
#
#everything looks okay, enter in pending queue.
#
else{
print <<"HTML";
<h1>Room Schedule Request from $contents{'name'}</h1>
<p><hr><p>
<i>$moy $dom, $year</i>
<ul>
<li>Title of Event = $contents{'title'}
<li>Submitter Name = $contents{'name'}
<li>Email address = $contents{'email'}
<li>Room Requested = $contents{'room'}
<li>Request Date = $contents{'month'} $contents{'day'}, $contents{'year'}
<li>From $contents{'start_time'} to $contents{'end_time'}
<li>Event Link = $contents{'linkto'}
<li>Event Description = $contents{'description'}
</ul>
HTML
#List of Metacharacters we need to check against
# &;`'\"|*?~<>^()[]{}$\n\r
$output = `submit '$contents{'name'}' '$contents{'email'}' '$contents{'phone'}' '$contents{'position'}' '$contents{'title'}' '$contents{'room'}' '$contents{'month'}' '$contents{'day'}' '$contents{'year'}' '$contents{'start_time'}' '$contents{'end_time'}'
'$contents{'linkto'}' '$contents{'description'}'`;
print <<"HTML";
<hr>
Thank you, $contents{'name'}, your request has been queued pending
approval. <br>
$output
</body>
</html>
HTML
}
siyang
include/msql.h"
#include <stdio.h>
#include <string.h>
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result, *q_result2;
m_row row_value, row_value2;
char tmp_str[335];
char tmp_str2[335];
int counter = 1;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL);
if (socket_value == -1) {
printf("Connection to Database failed\n");
return;
}
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("1API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Two Basic checks for coflicts*/
/*1) see if an existing resverstion has an end time during time period*/
sprintf(tmp_str, "select * from approved where end_time <= %s and end_time > %s and year = %s and month = %s and day = %s and room = \'%s\' and room <> 'Other' ", argv[11], argv[10], argv[9], argv[7], argv[8], argv[6]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("2API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*1st query done. Now need to store results and do 2nd check*/
q_result = msqlStoreResult();
/*2) see if an existing resverstion totaly overlaps time period*/
sprintf(tmp_str, "select * from approved where start_time <= %s and end_time > %s and year = %s and month = %s and day = %s and room = \'%s\' and room <> 'Other'", argv[10], argv[11], argv[9], argv[7], argv[8], argv[6]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("3API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*2st query done*/
q_result2 = msqlStoreResult();
if ((msqlNumRows(q_result) != 0) || (msqlNumRows(q_result2) != 0)) {
/*A conflict exists with the following entries*/
printf("<h4>This Room Reservation Conflicts with the following");
printf(" already approved reservations:</h4>\n");
/*Identify the number of fields in the table*/
num_fields = msqlNumFields(q_result);
printf("<HR>\n");
printf("<TABLE BORDER>\n");
printf("<TR>\n");
/*print out the tables field names*/
for (i = 0; i < num_fields-1; i++) {
if (i == 0) { /*check for unque identifier*/
field_value = msqlFetchField(q_result);
printf("<TH></TH>");
} else {
field_value = msqlFetchField(q_result);
printf("<TH>%s</TH>", field_value->name);
}
}
printf("</TR>\n");
printf("\n");
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf("<TR>\n");
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields-1; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_md.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\">%s</A>", row_value[i],
row_value[i]);
} else {
printf("<TD>%s</TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result);
printf("</TR>\n");
printf("\n");
}
row_value = msqlFetchRow(q_result2);
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields-1; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_md.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\">%s</A>", row_value[i],
row_value[i]);
} else {
printf("<TD>%s</TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result2);
printf("</TR>\n");
printf("\n");
}
printf("</TABLE>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
/*Free the value of the query*/
msqlFreeResult(q_result);
msqlClose(socket_value);
return;
} else {
printf("<pre>No time/room conflicts exist</pre>\n");
/*No time/room conflicts exist*/
sprintf(tmp_str, "insert into approved values (%s", argv[14]);
while (counter <= 6) {
sprintf(tmp_str2, ", '%s'", argv[counter]);
strcat(tmp_str, tmp_str2);
counter++;
}
for (counter = 7; counter < 12; counter++) {
sprintf(tmp_str2, ", %s", argv[counter]);
strcat(tmp_str, tmp_str2);
}
for (counter = 12; counter <= 13; counter++) {
if (argv[counter] != NULL) {
sprintf(tmp_str2, ", '%s'", argv[counter]);
strcat(tmp_str, tmp_str2);
} else {
sprintf(tmp_str2, ", NULL");
strcat(tmp_str, tmp_str2);
}
}
strcat(tmp_str, ")");
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("4API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<pre>value of tmp str ::%s::</pre>\n", tmp_str);
printf("<H1>Room Approval Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
printf("</BODY>\n");
msqlClose(socket_value);
return;
}
/*Row successfully added to approved table*/
/*Now delete existing row from pending_queue*/
sprintf(tmp_str,
"delete from pending_queue where pid = %s", argv[14]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("4API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Room Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
printf("</BODY>\n");
msqlClose(socket_value);
return;
}
/*Row successfully deleted from pending_queue*/
}
printf("<BODY>");
printf("<H1>Room Approval Submitted</H1>");
printf("<P>\n");
printf("<HR>The Room Schedule has been successfully\n");
printf("updated to reflect the new reservation\n");
printf("<BR>");
printf("Do you wish to send %s at %s email notification of room approval?", argv[1], argv[2]);
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/email_notice.cgi\" METHOD = POST>");
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", argv[14]);
printf("<INPUT NAME=\"status\" VALUE=1 TYPE=\"hidden\">");
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"Send Email Notification\">");
printf("</FORM>\n");
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
printf("</BODY>\n");
/*Free the value of the query*/
msqlFreeResult(q_result);
msqlClose(socket_value);
}
i
sisiyang
mports/bin/perl
# Author: David Wang davewang@wam.umd.edu
# : John Messina
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
#How many bytes are we supposed to receive?
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$buffer);
foreach $pair (@pairs)
{
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$contents{$name} = $value;
}
}
#
# Create the associative array to find the value of the months.
#
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is, and a numerical representation
# of it.
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 + $value{$moy} * 100 +$dom;
#
# We find a numerical value representation of request date.
#
$req_date=$contents{'year'}*10000+$contents{'month'}*100+$contents{'day'};
#
# used to check for invalid date entires.
#
$req_d_m=$contents{'month'}*100+$contents{'day'};
#
# We use this to figure out whether the user entered in
# something too short to be valid in these crucial fields.
#
$_ =$contents{'name'};
$namelen = tr/a-zA-Z//;
$_ =$contents{'email'};
$emaillen = tr/a-zA-Z//;
$illegal = tr/\;\'\"\&//;
$_ =$contents{'title'};
$titlelen = tr/a-zA-Z//;
###################################################
# CGI output: As HTML and as email to submitter
###################################################
# Create an html document on the fly.
print <<"HTML";
<html>
<head>
<title>This is the reply page</title>
</head>
<body>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
HTML
#check to make sure that end time is later than start time.
if ( $contents{'start_time'} >= $contents{'end_time'}) {
print <<"HTML";
<center><h1>Sorry, $contents{'name'}<h1></center>
<hr><h2>You've entered an invalid time.
please try again</h2>
</body>
</html>
HTML
}
#
#date entered was in past
#
elsif ( $today_date > $req_date ) {
print <<"HTML";
<center><h1>Sorry, $contents{'name'}<h1></center><hr>
<h2>You've entered an invalid date. please try again</h2>
Debug:
<br>Month = $contents{'month'}
<br>Day = $contents{day}
<br>year = $contents{year}
<br>today_date = $today_date
<br>req_date = $req_date
</body>
</html>
HTML
}
# check for exceptions, all dates listed below are illegal.
# Feb 29 is also declared illegal, because there won't be a
# leap year until the year 2004
elsif (($req_d_m==230)||($req_d_m==231)||($req_d_m==431)||($req_d_m==631)||
($req_d_m==931)||($req_d_m==1131)||($req_d_m==229)){
print <<"HTML";
<center><H1>Sorry, $contents{'name'}</H1></center><hr>
<h2>You've scheduled a meeting on a day which does not exist.
Please enter a valid date</h2>
</body>
</html>
HTML
}
# if some crucial fields are left blank
# return error message
#
elsif($namelen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You've entered in an invalid name<br>
Please enter a valid name</h2>
</body>
</html>
HTML
}
elsif($illegal>0){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>Your email address is an unusual one, we cannot accept it<br>
Could you please enter a different email address?<br>
</body>
</html>
HTML
}
elsif($emaillen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You didn't enter an invalid email address<br>
Please enter a valid email address</h2>
</body>
</html>
HTML
}
elsif($titlelen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You've entered in an invalid title for this meeting <br>
Please enter a valid title</h2>
</body>
</html>
HTML
}
#
#everything looks okay, enter in pending queue.
#
else{
print <<"HTML";
<h1>Room Schedule Request from $contents{'name'}</h1>
<p><hr><p>
<i>$moy $dom, $year</i>
<ul>
<li>Title of Event = $contents{'title'}
<li>Submitter Name = $contents{'name'}
<li>Email address = $contents{'email'}
<li>Room Requested = $contents{'room'}
<li>Request Date = $contents{'month'} $contents{'day'}, $contents{'year'}
<li>From $contents{'start_time'} to $contents{'end_time'}
<li>Event Link = $contents{'linkto'}
<li>Event Description = $contents{'description'}
</ul>
HTML
$output = `submit2 '$contents{'name'}' '$contents{'email'}' '$contents{'phone'}' '$contents{'position'}' '$contents{'title'}' '$contents{'room'}' '$contents{'month'}' '$contents{'day'}' '$contents{'year'}' '$contents{'start_time'}' '$contents{'end_time'}'
'$contents{'linkto'}' '$contents{'description'}' '$contents{'pid'}'`;
print <<"HTML";
<hr>
$output
</body>
</html>
HTML
}
numerical representation
# of it.
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 submit3.c
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <sys/types.h>
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result, *q_result2;
m_row row_value, row_value2;
char tmp_str[1024];
char tmp_str2[1024];
int counter = 1;
/* datatypes need to get time of day*/
struct timeval tp;
struct timezone *tzp;
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL);
if (socket_value == -1) {
printf("Connection to Database failed\n");
return;
}
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("1API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*
sprintf(tmp_str, "select * from approved where year = %s and month = %s and day = %s and room = '%s' and end_time <= %s and end_time > %s or start_time <= %s and end_time >= %s", argv[9], argv[7], argv[8], argv[6], argv[11], argv[10], argv[10], argv[11])
;
*/
/*Two Basic checks for coflicts*/
/*1) see if an existing resverstion has an end time during time period*/
/*added logical not pid to avoid conflicting with its old self*/
sprintf(tmp_str, "select * from approved where end_time <= %s and end_time > %s and year = %s and month = %s and day = %s and room = \'%s\' and pid <> %s and room <> 'Other'", argv[11], argv[10], argv[9], argv[7], argv[8], argv[6], argv[14]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("2API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*1st query done. Now need to store results and do 2nd check*/
q_result = msqlStoreResult();
/*2) see if an existing resverstion totaly overlaps time period*/
/*added logical not pid to avoid conflicting with its old self*/
sprintf(tmp_str, "select * from approved where start_time <= %s and end_time > %s and year = %s and month = %s and day = %s and room = \'%s\' and pid <> %s and room <> 'Other'", argv[10], argv[11], argv[9], argv[7], argv[8], argv[6], argv[14]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("3API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*2st query done*/
q_result2 = msqlStoreResult();
if ((msqlNumRows(q_result) != 0) || (msqlNumRows(q_result2) != 0)) {
/*A conflict exists with the following entries*/
printf("<h4>This Room Reservation Conflicts with the following");
printf(" already approved reservations:</h4>\n");
/*Identify the number of fields in the table*/
num_fields = msqlNumFields(q_result);
printf("<HR>\n");
printf("<TABLE BORDER>\n");
printf("<TR>\n");
/*print out the tables field names*/
for (i = 0; i < num_fields-1; i++) {
if (i == 0) { /*check for unque identifier*/
field_value = msqlFetchField(q_result);
printf("<TH></TH>");
} else {
field_value = msqlFetchField(q_result);
printf("<TH>%s</TH>", field_value->name);
}
}
printf("</TR>\n");
printf("\n");
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
printf("<TR>\n");
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields-1; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_rs.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\">%s</A>", row_value[i],
row_value[i]);
} else {
printf("<TD>%s</TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result);
printf("</TR>\n");
printf("\n");
}
row_value = msqlFetchRow(q_result2);
while (row_value != NULL) {
printf("<TR>\n");
for (i = 0; i < num_fields-1; i++) {
if (i == 0) {
printf("<TD>");
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/approve_rs.cgi\" METHOD = POST>")/
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", row_value[i]);
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"SELECT\">");
printf("</FORM>");
printf("</TD>");
} else if (i == 12) {
printf("<TD><A HREF=\"%s\">%s</A>", row_value[i],
row_value[i]);
} else {
printf("<TD>%s</TD>", row_value[i]);
}
}
row_value = msqlFetchRow(q_result2);
printf("</TR>\n");
printf("\n");
}
printf("</TABLE>\n");
printf("<HR><A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
/*Free the value of the query*/
msqlFreeResult(q_result);
msqlClose(socket_value);
return;
} else {
printf("<pre>No time/room conflicts exist</pre>\n");
/*No time/room conflicts exist*/
/*Get the time of day for new pid value*/
gettimeofday(&tp, NULL);
sprintf(tmp_str,
"insert into approved values (%ld", tp.tv_sec );
while (counter <= 6) {
sprintf(tmp_str2, ", '%s'", argv[counter]);
strcat(tmp_str, tmp_str2);
counter++;
}
for (counter = 7; counter < 12; counter++) {
sprintf(tmp_str2, ", %s", argv[counter]);
strcat(tmp_str, tmp_str2);
}
for (counter = 12; counter <= 13; counter++) {
if (argv[counter] != NULL) {
sprintf(tmp_str2, ", '%s'", argv[counter]);
strcat(tmp_str, tmp_str2);
} else {
sprintf(tmp_str2, ", NULL");
strcat(tmp_str, tmp_str2);
}
}
strcat(tmp_str, ")");
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("4API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Room Approval Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
printf("</BODY>\n");
msqlClose(socket_value);
return;
}
/*Row successfully added to approved table*/
/*Now delete existing row from approved*/
sprintf(tmp_str,
"delete from approved where pid = %s", argv[14]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("4API Insert Error: %s\n", msqlErrMsg);
printf("<BODY>");
printf("<H1>Room Deletion Failed</H1>");
printf("<P>\n");
printf("<HR>Please contact Dr. Pugh to \n");
printf("identify the nature of the problem.\n");
printf("<HR>\n");
printf("</BODY>\n");
msqlClose(socket_value);
return;
}
/*Row successfully deleted from approved*/
}
/*Send email to requestor about new room reservation*/
printf("<BODY>");
printf("<H1>Room Approval Submitted</H1>");
printf("<P>\n");
printf("<HR>The Room Schedule has been successfully\n");
printf("updated to reflect the new reservation\n");
printf("<BR>");
printf("Do you wish to send %s at %s email notification of room approval?", argv[1], argv[2]);
printf("<FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/email_notice.cgi\" METHOD = POST>");
printf("<INPUT NAME=\"pid\" VALUE=\"%s\" TYPE=\"hidden\">", argv[14]);
printf("<INPUT NAME=\"status\" VALUE=2 TYPE=\"hidden\">");
printf("<INPUT TYPE=\"SUBMIT\" VALUE=\"Send Email Notification\">");
printf("</FORM>\n");
printf("<HR>\n");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/room/html/room_admin.html\">Go Back to Main Admin Page</A>");
printf("</BODY>\n");
/*Free the value of the query*/
msqlFreeResult(q_result);
msqlClose(socket_value);
}
# Author: David Wang davewang@wam.umd.edu
# : John Messina
#Print this out no matter what.
print "Content-type: text/html\n\n";
#flush stdout buffer
$| = 1;
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
#How many bytes are we supposed to receive?
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$buffer);
foreach $pair (@pairs)
{
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$contents{$name} = $value;
}
}
#
# Create the associative array to find the value of the months.
#
$value{"Jan"} = 1;
$value{"Feb"} = 2;
$value{"Mar"} = 3;
$value{"Apr"} = 4;
$value{"May"} = 5;
$value{"Jun"} = 6;
$value{"Jul"} = 7;
$value{"Aug"} = 8;
$value{"Sep"} = 9;
$value{"Oct"} = 10;
$value{"Nov"} = 11;
$value{"Dec"} = 12;
#
# figure out what today's date is, and a numerical representation
# of it.
($dow,$moy,$dom,$tod,$timezone,$year)=split(/ +/,`date`);
$today_date = $year * 10000 + $value{$moy} * 100 +$dom;
#
# We find a numerical value representation of request date.
#
$req_date=$contents{'year'}*10000+$contents{'month'}*100+$contents{'day'};
#
# used to check for invalid date entires.
#
$req_d_m=$contents{'month'}*100+$contents{'day'};
#
# We use this to figure out whether the user entered in
# something too short to be valid in these crucial fields.
#
$_ =$contents{'name'};
$namelen = tr/a-zA-Z//;
$_ =$contents{'email'};
$emaillen = tr/a-zA-Z//;
$illegal = tr/\;\'\"\&//;
$_ =$contents{'title'};
$titlelen = tr/a-zA-Z//;
###################################################
# CGI output: As HTML and as email to submitter
###################################################
# Create an html document on the fly.
print <<"HTML";
<html>
<head>
<title>This is the reply page</title>
</head>
<body>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
HTML
#check to make sure that end time is later than start time.
if ( $contents{'start_time'} >= $contents{'end_time'}) {
print <<"HTML";
<center><h1>Sorry, $contents{'name'}<h1></center>
<hr><h2>You've entered an invalid time.
please try again</h2>
</body>
</html>
HTML
}
#
#date entered was in past
#
elsif ( $today_date > $req_date ) {
print <<"HTML";
<center><h1>Sorry, $contents{'name'}<h1></center><hr>
<h2>You've entered an invalid date. please try again</h2>
Debug:
<br>Month = $contents{'month'}
<br>Day = $contents{day}
<br>year = $contents{year}
<br>today_date = $today_date
<br>req_date = $req_date
</body>
</html>
HTML
}
# check for exceptions, all dates listed below are illegal.
# Feb 29 is also declared illegal, because there won't be a
# leap year until the year 2004
elsif (($req_d_m==230)||($req_d_m==231)||($req_d_m==431)||($req_d_m==631)||
($req_d_m==931)||($req_d_m==1131)||($req_d_m==229)){
print <<"HTML";
<center><H1>Sorry, $contents{'name'}</H1></center><hr>
<h2>You've scheduled a meeting on a day which does not exist.
Please enter a valid date</h2>
</body>
</html>
HTML
}
# if some crucial fields are left blank
# return error message
#
elsif($namelen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You've entered in an invalid name<br>
Please enter a valid name</h2>
</body>
</html>
HTML
}
elsif($illegal>0){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>Your email address is an unusual one, we cannot accept it<br>
Could you please enter a different email address?<br>
</body>
</html>
HTML
}
elsif($emaillen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You didn't enter an invalid email address<br>
Please enter a valid email address</h2>
</body>
</html>
HTML
}
elsif($titlelen<2){
print <<"HTML";
<H1><center>Sorry, $contents{'name'}</center></H1>
<hr>
<h2>You've entered in an invalid title for this meeting <br>
Please enter a valid title</h2>
</body>
</html>
HTML
}
#
#everything looks okay, enter in pending queue.
#
else{
print <<"HTML";
<h1>Room Schedule Request from $contents{'name'}</h1>
<p><hr><p>
<i>$moy $dom, $year</i>
<ul>
<li>Title of Event = $contents{'title'}
<li>Submitter Name = $contents{'name'}
<li>Email address = $contents{'email'}
<li>Room Requested = $contents{'room'}
<li>Request Date = $contents{'month'} $contents{'day'}, $contents{'year'}
<li>From $contents{'start_time'} to $contents{'end_time'}
<li>Event Link = $contents{'linkto'}
<li>Event Description = $contents{'description'}
</ul>
HTML
$output = `submit3 '$contents{'name'}' '$contents{'email'}' '$contents{'phone'}' '$contents{'position'}' '$contents{'title'}' '$contents{'room'}' '$contents{'month'}' '$contents{'day'}' '$contents{'year'}' '$contents{'start_time'}' '$contents{'end_time'}'
'$contents{'linkto'}' '$contents{'description'}' '$contents{'pid'}'`;
print <<"HTML";
<hr>
Thank you, $contents{'name'}, your request has been queued pending
approval. <br>
$output
</body>
</html>
HTML
}
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/5/96
Purpose: Print out a room reservation request form
page, based on the date and room selected
from the availablity page. In addition, any
unavailable times for the room on that day
will be listed.
Companion Code: request_rm.cgi
**************************************************/
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
putenv("MSQL_UNIX_PORT=/panache/web30/Minerva/bin/tmp3");
socket_value = msqlConnect(NULL); /*returns socket descriptor*/
/*NULL argument defaults to to localhost*/
if (socket_value == -1) {
printf("Connection to Database failed\n");
return; /*no connection was made*/
}
/*Connection has been made*/
/*Select the CS_ROOM reservation Database */
return_value = msqlSelectDB(socket_value, "cs_room");
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully selected*/
/*Query the Database to check for unavailable times*/
sprintf(tmp_str, "select start_time, end_time from approved where room = '%s' and day = %s and month = %s and year = %s", argv[1], argv[3], argv[2], argv[4]);
return_value = msqlQuery(socket_value, tmp_str);
if (return_value == -1) {
printf("API Error: %s\n", msqlErrMsg);
msqlClose(socket_value);
return;
}
/*Database successfully queried*/
/*Store the value of the query*/
q_result = msqlStoreResult();
/* See if there are any results returned from the database*/
if (msqlNumRows(q_result) != 0) {
printf("<h2>Unavailable times for %s on %s/%s/%s:</h2>\n", argv[1], argv[2], argv[3], argv[4]);
/*Fetch rows and print out the values*/
row_value = msqlFetchRow(q_result);
while (row_value != NULL) {
for (i = 0; i < 2; i++) {
if (i == 0) printf("From \n"); else printf(" To \n");
switch (atoi(row_value[i])) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
}
}
printf("<br>\n");
row_value = msqlFetchRow(q_result);
}
} else {
printf("<h2>%s is available all day</h2>\n", argv[1]);
}
printf("<HR>\n");
printf(" <P><B> <FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/submit.cgi\" METHOD = POST> ");
printf(" <center> <H2> Room Scheduling Request Form </H2> </center> <hr size=3> <P> ");
printf(" <CODE><b> Requestor Name......</b></FONT></CODE> <INPUT NAME=\"name\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Email address.......</b></FONT></CODE> ");
printf(" <INPUT NAME=\"email\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Title of the Event..</b></FONT></CODE> ");
printf(" <INPUT NAME=\"title\" MAXLENGTH=60 SIZE=40 ><BR>");
printf(" <CODE><b> Phone Number........</b></FONT></CODE> <INPUT NAME=\"phone\" MAXLENGTH=60 SIZE=40> <BR>");
printf(" <P><CODE><b>Position</b></FONT></CODE> <select NAME=\"position\">");
printf("<option selected>Student ");
printf("<option> Student <option> Faculty <option> Other");
printf("</select>");
printf("<p> <code><b>Room to be reserved </b></font></code> ");
printf(" <select name=\"room\"> ");
printf(" <option selected value=\"%s\">%s", argv[1], argv[1]);
printf("<option value=\"AVW1112\">AVW1112 <option value=\"AVW1152\">AVW1152 <option value=\"AVW3258\">AVW3258 <option value=\"AVW4185\">AVW4185 <option value=\"Other\">Other </select> ");
printf(" <table><tr><td><code><b>Date...............</b></font></code><td> <select name=\"month\">");
switch (atoi(argv[2])) {
case 1: {
printf(" <option selected value=1>January");
break;
}
case 2: {
printf(" <option selected value=2>Febuary");
break;
}
case 3: {
printf(" <option selected value=3>March");
break;
}
case 4: {
printf(" <option selected value=4>April");
break;
}
case 5: {
printf(" <option selected value=5>May");
break;
}
case 6: {
printf(" <option selected value=6>June");
break;
}
case 7: {
printf(" <option selected value=7>July");
break;
}
case 8: {
printf(" <option selected value=8>August");
break;
}
case 9: {
printf(" <option selected value=9>September");
break;
}
case 10: {
printf(" <option selected value=10>October");
break;
}
case 11: {
printf(" <option selected value=11>November");
break;
}
case 12: {
printf(" <option selected value=12>December");
break;
}
}
printf(" <option value=1>January <option value=2>February <option value=3>March ");
printf(" <option value=4>April <option value=5>May <option value=6>June <option value=7>July <option value=8>August <option value=9>September ");
printf(" <option value=10>October <option value=11>November <option value=12>December</select> <td> <select name=\"day\"> <option selected>%s", argv[3]);
printf("<option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11 <option>12 <option>13 <option>14 <option>15 <option>16 <option>17 <option>18 <option>19 <option>20 <option>21 <option>22 <option>23 <o
ption>24 <option>25 ");
printf(" <option>26 <option>27 <option>28 <option>29 <option>30 <option>31</select> <td> <select name=\"year\"> <option selected>%s <option>1996 <option >1997 <option >1998 <option >1999</select> ", argv[4]);
printf(" </tr> </table> <table><tr> <td><code><b>Time...............</b></font></code> <td><select name=\"start_time\"> ");
printf(" <option value=800>8:00 AM <option value=830>8:30 AM <option value=900>9:00 AM ");
printf(" <option value=930>9:30 AM <option value=1000>10:00 AM <option value=1030>10:30 AM <option value=1100>11:00 AM <option value=1130>11:30 AM <option value=1200>12:00 PM <option value=1230>12:30 PM ");
printf(" <option value=1300>1:00 PM <option value=1330>1:30 PM <option value=1400>2:00 PM <option value=1430>2:30 PM <option value=1500>3:00 PM <option value=1530>3:30 PM <option value=1600>4:00 PM <option value=1630>4:30 PM <option value=1700>5:00 PM <o
ption value=1730>5:30 PM ");
printf(" <option value=\"1800\">6:00 PM</select> <td>To: <td><select name=\"end_time\">");
printf(" <option value=\"830\">8:30 AM <option value=\"900\">9:00 AM <option value=\"930\">9:30 AM <option value=\"1000\">10:00 AM ");
printf(" <option value=\"1030\">10:30 AM <option value=\"1100\">11:00 AM <option value=\"1130\">11:30 AM <option value=\"1200\">12:00 PM <option value=\"1230\">12:30 PM <option value=\"1300\">1:00 PM <option value=\"1330\">1:30 PM <option value=\"1400\">
2:00 PM ");
printf(" <option value=\"1430\">2:30 PM <option value=\"1500\">3:00 PM <option value=\"1530\">3:30 PM <option value=\"1600\">4:00 PM <option value=\"1630\">4:30 PM <option value=\"1700\">5:00 PM <option value=\"1730\">5:30 PM <option value=\"1800\">6:00
PM ");
printf(" <option value=\"1830\">6:30 PM</select> </tr> </table> Link to the event web page (optional)<br> <INPUT NAME=\"linkto\" MAXLENGTH=\"60\" SIZE=\"60\" ><BR> Or, Short description of the event<BR> ");
printf(" <TEXTAREA NAME=\"description\" ROWS=3 COLS=50></TEXTAREA> <BR> <hr size=2> <P><CENTER> <INPUT TYPE=\"SUBMIT\" VALUE=\"Submit\"> <INPUT TYPE=\"RESET\" VALUE=\"Reset Values\"> ");
printf(" </CENTER> </FORM> ");
printf("<HR>");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/\">Go Back To Main Page</A>\n");
/*Free the value of the query*/
msqlFreeResult(q_result);
/*Close connection*/
msqlClose(socket_value);
}
ne\" MAXLENGTH=60 SIsubmit5.c
#include <stdio.h>
#include <string.h>
/**************************************************
Author: John Messina
Last Modified Date: 5/6/96
Purpose: Print out a room reservation request form
page, based on the start time selected
from the availablity page.
Companion Code: request_hr.cgi
**************************************************/
int main(argc, argv)
int argc;
char *argv[];
{
int socket_value = 0;
int return_value = 0;
int num_fields = 0;
int i;
m_field *field_value;
m_result *q_result;
m_row row_value;
char tmp_str[125];
char tmp_str2[125];
printf("<HR>\n");
printf(" <P><B> <FORM ACTION=\"http://panache.cs.umd.edu:8080/~web28/room/cgi/submit.cgi\" METHOD = POST> ");
printf(" <center> <H2> Room Scheduling Request Form </H2> </center> <hr size=3> <P> ");
printf(" <CODE><b> Requestor Name......</b></FONT></CODE> <INPUT NAME=\"name\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Email address.......</b></FONT></CODE> ");
printf(" <INPUT NAME=\"email\" MAXLENGTH=60 SIZE=40 ><BR> <CODE><b> Title of the Event..</b></FONT></CODE> ");
printf(" <INPUT NAME=\"title\" MAXLENGTH=60 SIZE=40 ><BR>");
printf(" <CODE><b> Phone Number........</b></FONT></CODE> <INPUT NAME=\"phone\" MAXLENGTH=60 SIZE=40> <BR>");
printf(" <P><CODE><b>Position</b></FONT></CODE> <select NAME=\"position\">");
printf("<option selected>Student ");
printf("<option> Student <option> Faculty <option> Other");
printf("</select>");
printf("<p> <code><b>Room to be reserved </b></font></code> ");
printf(" <select name=\"room\"> ");
printf(" <option selected value=\"AVW1112\">AVW1112");
printf("<option value=\"AVW1152\">AVW1152 <option value=\"AVW3258\">AVW3258 <option value=\"AVW4185\">AVW4185 <option value=\"Other\">Other </select> ");
printf(" <table><tr><td><code><b>Date...............</b></font></code><td> <select name=\"month\">");
switch (atoi(argv[2])) {
case 1: {
printf(" <option selected value=1>January");
break;
}
case 2: {
printf(" <option selected value=2>Febuary");
break;
}
case 3: {
printf(" <option selected value=3>March");
break;
}
case 4: {
printf(" <option selected value=4>April");
break;
}
case 5: {
printf(" <option selected value=5>May");
break;
}
case 6: {
printf(" <option selected value=6>June");
break;
}
case 7: {
printf(" <option selected value=7>July");
break;
}
case 8: {
printf(" <option selected value=8>August");
break;
}
case 9: {
printf(" <option selected value=9>September");
break;
}
case 10: {
printf(" <option selected value=10>October");
break;
}
case 11: {
printf(" <option selected value=11>November");
break;
}
case 12: {
printf(" <option selected value=12>December");
break;
}
}
printf(" <option value=1>January <option value=2>February <option value=3>March ");
printf(" <option value=4>April <option value=5>May <option value=6>June <option value=7>July <option value=8>August <option value=9>September ");
printf(" <option value=10>October <option value=11>November <option value=12>December</select> <td> <select name=\"day\"> <option selected>%s", argv[3]);
printf("<option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11 <option>12 <option>13 <option>14 <option>15 <option>16 <option>17 <option>18 <option>19 <option>20 <option>21 <option>22 <option>23 <o
ption>24 <option>25 ");
printf(" <option>26 <option>27 <option>28 <option>29 <option>30 <option>31</select> <td> <select name=\"year\"> <option selected>%s <option>1996 <option >1997 <option >1998 <option >1999</select> ", argv[4]);
printf(" </tr> </table> <table><tr> <td><code><b>Time...............</b></font></code> <td><select name=\"start_time\"> ");
printf(" <option selected value=%s>\n", argv[1]);
switch (atoi(argv[1])) {
case 800: {
printf("8:00 AM");
break;
}
case 830: {
printf("8:30 AM");
break;
}
case 900: {
printf("9:00 AM");
break;
}
case 930: {
printf("9:30 AM");
break;
}
case 1000: {
printf("10:00 AM");
break;
}
case 1030: {
printf("10:30 AM");
break;
}
case 1100: {
printf("11:00 AM");
break;
}
case 1130: {
printf("11:30 AM");
break;
}
case 1200: {
printf("12:00 PM");
break;
}
case 1230: {
printf("12:30 PM");
break;
}
case 1300: {
printf("1:00 PM");
break;
}
case 1330: {
printf("1:30 PM");
break;
}
case 1400: {
printf("2:00 PM");
break;
}
case 1430: {
printf("2:30 PM");
break;
}
case 1500: {
printf("3:00 PM");
break;
}
case 1530: {
printf("3:30 PM");
break;
}
case 1600: {
printf("4:00 PM");
break;
}
case 1630: {
printf("4:30 PM");
break;
}
case 1700: {
printf("5:00 PM");
break;
}
case 1730: {
printf("5:30 PM");
break;
}
case 1800: {
printf("6:00 PM");
break;
}
}
printf(" <option value=800>8:00 AM <option value=830>8:30 AM <option value=900>9:00 AM ");
printf(" <option value=930>9:30 AM <option value=1000>10:00 AM <option value=1030>10:30 AM <option value=1100>11:00 AM <option value=1130>11:30 AM <option value=1200>12:00 PM <option value=1230>12:30 PM ");
printf(" <option value=1300>1:00 PM <option value=1330>1:30 PM <option value=1400>2:00 PM <option value=1430>2:30 PM <option value=1500>3:00 PM <option value=1530>3:30 PM <option value=1600>4:00 PM <option value=1630>4:30 PM <option value=1700>5:00 PM <o
ption value=1730>5:30 PM ");
printf(" <option value=\"1800\">6:00 PM</select> <td>To: <td><select name=\"end_time\">");
printf(" <option value=\"830\">8:30 AM <option value=\"900\">9:00 AM <option value=\"930\">9:30 AM <option value=\"1000\">10:00 AM ");
printf(" <option value=\"1030\">10:30 AM <option value=\"1100\">11:00 AM <option value=\"1130\">11:30 AM <option value=\"1200\">12:00 PM <option value=\"1230\">12:30 PM <option value=\"1300\">1:00 PM <option value=\"1330\">1:30 PM <option value=\"1400\">
2:00 PM ");
printf(" <option value=\"1430\">2:30 PM <option value=\"1500\">3:00 PM <option value=\"1530\">3:30 PM <option value=\"1600\">4:00 PM <option value=\"1630\">4:30 PM <option value=\"1700\">5:00 PM <option value=\"1730\">5:30 PM <option value=\"1800\">6:00
PM ");
printf(" <option value=\"1830\">6:30 PM</select> </tr> </table> Link to the event web page (optional)<br> <INPUT NAME=\"linkto\" MAXLENGTH=\"60\" SIZE=\"60\" ><BR> Or, Short description of the event<BR> ");
printf(" <TEXTAREA NAME=\"description\" ROWS=3 COLS=50></TEXTAREA> <BR> <hr size=2> <P><CENTER> <INPUT TYPE=\"SUBMIT\" VALUE=\"Submit\"> <INPUT TYPE=\"RESET\" VALUE=\"Reset Values\"> ");
printf(" </CENTER> </FORM> ");
printf("<HR>");
printf("<A HREF=\"http://panache.cs.umd.edu:8080/~web28/\">Go Back To Main Page</A>\n");
}
ODE> <INPUT NAME=\"phone\" MAXLENGTH=60 SIZE=40> <BR>");
printf(" <P><CODE><b>Position</b></FONT></CODE> <select NAME=\"position\">");
printf("<option selected>Student ");
printf("<option> Student <option> Faculty <option> Other");
printf("</select>");
printf("<p> <code><b>Room to be reserved </b></font></code> ");
printf(
------------------------------
Date: Tue, 11 Feb 1997 16:55:04 -0800
From: Charles Peri - EUCD ~ <cperi@pcocd2.intel.com>
Subject: Sourcing files from my perl script
Message-Id: <330114E8.167E@pcocd2.intel.com>
Hi all,
I am trying to source a file which sets env variables
from inside my perl script. Since I need these env variables
later in my program, I have to get the vaiables set by
the source command.
For example :
if file, "file_to_source" has
setenv NAME some_name
setenv VAR1 varable1
setenv VAR2 variable2
Inside my perl script, I need to source the above file and
should be able to use later VAR1 and VAR2.
I know if I use system command to source the file, it spawns a
process to spawn, so all the env variables are lost !!
Can anyone help me in this situation!
Many Thanks,
Charles Peri
------------------------------
Date: 12 Feb 1997 02:41:52 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Sourcing files from my perl script
Message-Id: <slrn5g2ba8.8r8.dave@fast.thomases.com>
On Tue, 11 Feb 1997 16:55:04 -0800, Charles Peri - EUCD ~ <cperi@pcocd2.intel.com> wrote:
> Hi all,
>
> I am trying to source a file which sets env variables
> from inside my perl script. Since I need these env variables
> later in my program, I have to get the vaiables set by
> the source command.
>
> For example :
> if file, "file_to_source" has
> setenv NAME some_name
> setenv VAR1 varable1
> setenv VAR2 variable2
If you just want to set variables, then:
my $input =
'setenv NAME some_name
setenv VAR1 varable1
setenv VAR2 variable2
';
for (split(/\n/, $input)) { # equivalent to while (<IPFILE>)
my ($dummy, $name, $value) = split;
$ {$name} = $value;
}
print "NAME=$NAME, VAR1=$VAR1, VAR2=$VAR2\n";
# or the somewhat more compact...
undef $NAME;undef $VAR1;undef $VAR2;
$input =~ s/setenv\s+(\w+)\s+(\w+)/$ {$1} = $2/gem;
print "NAME=$NAME, VAR1=$VAR1, VAR2=$VAR2\n";
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 12 Feb 1997 02:17:20 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: use perl module, @INC, and -I
Message-Id: <slrn5g29s6.8r8.dave@fast.thomases.com>
On Tue, 11 Feb 1997 15:10:32 -0500, Steve Friedland <srf@ssih.com> wrote:
> I am having trouble getting perl to find my perl module.
>
> I have created a simple perl module (SRF.pm) located in the directory
> /users/srf/modules. In order for my program located in /users/srf/perl
> to run, the perl module must either be in /users/srf/perl, or I must use
> the command line option (-I/users/srf/open).
>
> If I remove the "-I/users/srf/open" line from junk.pl below, the
> "unshift(@INC,'/users/srf/open');" should prepend my module directory to
> the @INC array, and find my module. It doesn't work that way though. If
> I comment out the "use SRF;" line so the program will run, printing @INC
> shows that "/users/srf/modules" is the first entry! Why can't it find my
> module? I am running perl5.003 on OSF1v3.2.
The unshift is being executed at run-time, but the use is used at compile
time - you're adding the path too late! You can either put the unshift in a
begin block, or use the 'use lib' syntax.
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Tue, 11 Feb 1997 17:27:57 -0800
From: David Ransier <davidr@wv.mentorg.com>
Subject: Where is PerlTk discussed on Usenet
Message-Id: <33011C9D.41C67EA6@wv.mentorg.com>
Is there a special news group for discussions on PerlTk?
If this is it, then does anyone know when PerlTk will be supported
on Win32 platforms? Since both Perl and Tk exist on Win32, it would
seem that PerlTk should follow soon.
Thanks,
David R
--
+++++++++++++
David Ransier
davidr@wv.mentorg.com These comments are my own. I paid for
Office: (503) 685-1528 them. I own them. They're not my
Fax: (503) 685-1599 employers, and you can't have them.
+++++++++++++
------------------------------
Date: 12 Feb 1997 02:30:51 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Where is PerlTk discussed on Usenet
Message-Id: <5dra0r$soq@fridge-nf0.shore.net>
David Ransier (davidr@wv.mentorg.com) wrote:
: Is there a special news group for discussions on PerlTk?
comp.lang.perl.tk
: If this is it, then does anyone know when PerlTk will be supported
: on Win32 platforms? Since both Perl and Tk exist on Win32, it would
: seem that PerlTk should follow soon.
To my knowledge, there's not a pTk port for NT, although a little bird
(make that a VERY little bird) told me that Nick Ing-Simmons was working
on one. After exploring the vast differences between Unix/PCs, you'll
note that this is a lofty project. :-)
--
Nathan V. Patwardhan
nvp@shore.net
"send me mail"
--Jamie Zawinski
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Jan 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V7 Issue 931
*************************************