#!/usr/bin/perl srand; ### Print html and results print "Content-TYPE: text/html\n\n"; $search = ; ($command,$name)=split(/\=/,$search); if (($command ne "check")&&($search)){ print ""; print "Sample inn "; print "\n"; open(FILE, "DATA/inns.txt"); while () { ($_==$name)&&(print "$name already exists")&&(exit); } (open(FILE, ">>DATA/inns.txt"))||(print "bad dog \>\>DATA/inns.txt $! "); (print FILE "\n$name"); print "$name
added to Database

Courtesy of Byron"; exit; } if (($command eq "check")&&($search)){ print ""; print "Sample inn "; print "\n"; open(FILE, "DATA/inns.txt")||(print "bad dog DATA/inns.txt $! "); while () {( $hash[$i]=$_)&&($i++);} (!$name)&&($name=1); $file=$hash[$name]; chop $file; $name; print "next inn"; (open (INDEX,"<../$file/index.html"))||(open (INDEX,"<\/bb/$file/index.htm"))||(print "../$file/index.html $! "); while (){ s/IMG SRC\=\"/img src="..\/$file\//ig; s/BACKGROUND\=\"/BACKGROUND\=\"http\:\/\/www\.travelguides\.com\/bb\/$file\//i; print; } } ################# $j=0; $i=0; open(FILE, "DATA/inns.txt")||(print "bad dog DATA/inns.txt $! "); while () {( $hash[$i]=$_)&&($i++);} #not really a hash, just to keep you on your toes $random= int rand(30); $file=$hash[$random]; chop $file; (open (INDEX,"<../$file/index.html"))||(open (INDEX,"<\/bb/$file/index.htm"))||(print "../$file/index.html $! "); while (){ s/IMG SRC\=\"/img src="..\/$file\//ig; s/BACKGROUND\=\"/BACKGROUND\=\"http\:\/\/www\.travelguides\.com\/bb\/$file\//i; print; } #print "$hash[$random]
"; #print "

";