#!/usr/local/bin/perl $term = '20001'; $current_sem = '20003'; $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/[\/]+$/\//; @allCookies = split(/; /,$ENV{'HTTP_COOKIE'}); foreach $pair (@allCookies) { ($name, $value) = split(/=/, $pair); $cookies{$name} = $value; } ($cmd,@param) = split(/\,/,$ENV{QUERY_STRING}); $out = "COURSE SELECTIONS

\n"; $out .= " "; if ($param[0] eq 'delete') { $setcookies = "Set-Cookie: $param[1]=-999; domain=siteman.npil.com; path=/;\n"; $setcookies .= "Set-Cookie: $param[1]=-999; domain=www.scps.nyu.edu; path=/;\n"; print "content-type: text/html $setcookies "; exit; } elsif ($param[0] eq 'removeall') { foreach $key (keys(%cookies)) { if (($key =~ /[XR]/) && ($cookies{$key} != -999)) { $setcookies .= "Set-Cookie: $key=-999; domain=siteman.npil.com; path=/;\n"; $setcookies .= "Set-Cookie: $$key=-999; domain=www.scps.nyu.edu; path=/;\n"; } } print "content-type: text/html $setcookies "; exit; } $numcourses = 0; foreach $key (keys(%cookies)) { if (($key =~ /[XR]/) && ($cookies{$key} != -999)) { $numcourses++; $temp_section = $cookies{$key}; $temp_section =~ s/\D//g; $temp_section =~ s/^[0]+//; if ($temp_seciton < 10) {$temp_section = "00$temp_section";} elsif ($temp_section < 100) {$temp_section = "0$temp_section";} ($prefix,$suffix) = split (/\./,$key,2); $course_inputs .= "\n"; $course_inputs .= "\n"; $course_inputs .= "\n"; } } if ($ENV{'HTTP_COOKIE'} !~ /\w/) { $out .= "It appears that you have not yet selected any courses.

\n"; $out .= "If you have chosen a course, then most likely your web browser is not configured to accept cookies, which are needed to hold your course information.\n"; $out .= "If this is the case, please change your browser configuration, if you would like to register online.\n"; } else { if ($numcourses > 0) { $out .= "
Remove All
\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; foreach $key (keys(%cookies)) { if (($key =~ /[XR]/) && ($cookies{$key} != -999)) { $real_section = $cookies{$key}; open (CFILE,"$testdir/datafiles/courses$term.txt") || open (CFILE,"$livedir/datafiles/courses$term.txt") || die("couldn't read course file!!!"); while ($nextcourse = ) { @courseinfo = split(/\t/,$nextcourse); if (($courseinfo[0] eq $key) && ($courseinfo[1] eq $real_section)) { $fc_id = $courseinfo[3]; ($theperiod,$junk) = split (/\(/,$courseinfo[5]); $facname = 'TBA'; if ($fc_id > 0) { open (FFILE,"$testdir/datafiles/faculty$term.txt"); while ($nextfac = ) { @facinfo = split (/\t/,$nextfac); if ($facinfo[0] eq $fc_id) { $facname = "$facinfo[1] $facinfo[2]"; } } close FFILE; } $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; } } close (CFILE); } } $out .= "
Course CodeSect.Course NameFeeDays/TimeInstructor 
$key$cookies{$key}$courseinfo[4]\$$courseinfo[2]$theperiod$facnameRemove
\n"; $out .= "\n"; $out .= "\n"; $out .= $course_inputs; $out .= "

\n"; $out .= "

Print Registration Form"; } else { $out .= "You have not selected any courses."; $out .= "

Please browse our site for a complete listing of available courses."; $out .= "

Or, go Directly to Albert.\n"; $out .= ""; } } if (open(FILE,"$testdir/Study_Options$cmd.html") || open(FILE,"$livedir/Study_Options$cmd.html")) { while ($nextline = ) { $content .= $nextline; } close FILE; } else {die ("Cannot read index file!!!\n");} $content =~ s/studon\.gif/studoff\.gif/gi; $content =~ s/viewoff\.gif/viewon\.gif/gi; $titlebase = "NYU Center for Publishing Course Selections<\/title> <base href=\"$basehref\"> "; $content =~ s/location=\'/location=\'$basehref/g; $content =~ s/<title>[\x00-\xff]*<\/title>/$titlebase/i; $content =~ s/<!--BEGIN_PAGE_TEXT-->[\x00-\xff]*<!--END_PAGE_TEXT-->/$out/; $content =~ s/<!--BEGIN_NAVIGATION_MENU-->[\x00-\xff]*<!--END_NAVIGATION_MENU-->//; print "content-type: text/html $content ";