#!/usr/local/bin/perl ($course,$section,$cmd) = split(/\,/,$ENV{'QUERY_STRING'}); @cookies = split(/; /,$ENV{'HTTP_COOKIE'}); $testdir = 'c:/www/siteman/client/nyucfp/website/cfp20001'; $livedir = '/usr/local/ns-home/cfpweb'; $basehref = "http://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}"; $basehref =~ s/cgi\-bin\/[\x00-\xff]+//; $basehref =~ s/[\/]+$/\//; $numberofcourses = 0; foreach $cookie (@cookies) { ($temp_course,$temp_section) = split (/=/,$cookie); if (($cookie =~ /X\d\d/) || ($cookie =~ /\R\d\d/) || ($cookie =~ /\Y\d\d/)) { if ($temp_section > 0) { $numberofcourses++; } } } $onemonth = time + 84000; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdat) = gmtime($onemonth); $month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon]; $weekday = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Satruday)[$wday]; $year += 1900; $exptime = $weekday." ".$mday."-".$month."-".$year." ".$hour.":".$min.":".$sec; if ($numberofcourses < 5) { $setcookies = "Set-Cookie: $course=$section; expires=$exptime; domain=siteman.npil.com; path=/;\n"; $setcookies .= "Set-Cookie: $course=$section; expires=$exptime; domain=www.scps.nyu.edu; path=/;"; $out = "Course $course, Section $section has been added to your course selections.
\n"; $out .= "\n"; } else { $out = "You have already selected 5 courses. Please view your course selections to remove a course.
\n";
}
if (open(FILE,"$testdir/Study_Options$cmd.html") || open(FILE,"$livedir/Study_Options$cmd.html")) {
while ($nextline =