#!/usr/bin/perl require "cgi-lib.cgi"; &ReadParse; #print "Content-type: text/html\n\n"; print" "; print"
"; print"
"; print"
Select a Theatre
\n"; print"
----------
\n"; print"
New Jersey
\n"; print"
----------
\n"; my $dbh=connect_database(); my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=? group by theatre_name' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('New Jersey'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } print"
----------
\n"; print"
New York City
\n"; print"
----------
\n"; my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=? group by theatre_name' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('New York City'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } print"
----------
\n"; print"
Westchester
\n"; print"
----------
\n"; my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=? group by theatre_name' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('Westchester'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } print"
----------
\n"; print"
Rockland County
\n"; print"
----------
\n"; my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=? group by theatre_name' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('Rockland County'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } print"
----------
\n"; print"
Long Island
\n"; print"
----------
\n"; my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=? group by theatre_name' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('Long Island'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } print"
----------
\n"; print"
Pennsylvania
\n"; print"
----------
\n"; my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=? group by theatre_name' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('Pennsylvania'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } #print"
----------
\n"; #print"
Connecticut
\n"; #print"
----------
\n"; my $sth = $dbh->prepare('select id,theatre_name,movie_phone_link, activation from ClearViewCinemas_Locations where location=?' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute('Connecticut'); while(@data = $sth->fetchrow_array()) { $id =@data[0]; $theatre_name =@data[1]; $movie_phone_link=@data[2]; $activation =@data[3]; if($activation eq "Yes") { print"
$theatre_name
\n"; } } print"
\n"; print"
"; ############################################################################################################################ sub connect_database { # Connect to the requested server use DBI; my $dbh= DBI->connect("DBI:mysql:clearview:localhost",'clearview','clearm0v1es'); if (not $dbh) { error(); } return $dbh; } ########################################## sub error { print "Content-type: text/html\n\n"; print "\n"; print ""; print "error occured connecting to MySQL server\n"; print ""; exit; }
#!/usr/bin/perl require "cgi-lib.cgi"; &ReadParse; # following line sometimes shows up in html on some page but if removed throws an error on other ones. #print "Content-type: text/html\n\n"; #get a date from a server #------------------------------------------------------------- my $dbh=connect_database(); my $sth = $dbh->prepare('Select Current_Date;' ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute(); while(@data = $sth->fetchrow_array()) { $date=@data[0]; } #------------------------------------------------------------- ©_file; foreach $main_line (@main) { @wrd_seprtor = split(/\^/,$main_line); if($wrd_seprtor[31] le "$date") { $id[$idCount++] =$wrd_seprtor[0]; $title[$titleCount++] =$wrd_seprtor[1]; } if($wrd_seprtor[30] eq "Y") { $id_picture[$id_pictureCount++] =$wrd_seprtor[0]; $top_4[$top_4Count++] =$wrd_seprtor[30]; $picture[$pictureCount++] =$wrd_seprtor[3]; } } ######################################## START SORT ###################################### $array=(" "); $real_array=("z","z"); $num_of_items=0; for ($i=0; $i<$idCount; $i++) { $array[$i]=$title[$i]; } $num_of_items=@array; for($i=0; $i<=$num_of_items; $i++) { $real_array[$i]="zz"; } for($count=0;$count<$num_of_items;$count++) { for($i=0;$i<$num_of_items;$i++) { if($real_array[$count] gt $array[$i]) { $real_array[$count]=$array[$i]; $New_id[$count]=$id[$i]; $temp=$i; } } $array[$temp]="zz"; } ########################################### END SORT #################################### print" "; print"
"; print"
"; print"
Select a Movie
"; for($i=0;$i<$idCount;$i++) { print"
$real_array[$i]
\n"; } print"
\n"; ############################################################################################################################ sub connect_database { # Connect to the requested server use DBI; my $dbh= DBI->connect("DBI:mysql:clearview:localhost",'clearview','clearm0v1es'); if (not $dbh) { error(); } return $dbh; } ########################################## sub error { print "Content-type: text/html\n\n"; print "\n"; print ""; print "error occured connecting to MySQL server\n"; print ""; exit; } sub copy_file{ open(MAIN,"clearview_movie.dat") || die "clearview_movie.dat - Can't open jobs file for reading $!\n"; @main =
; close(MAIN); }