#!/usr/local/bin/perl #======================================== # START EDITING HERE #======================================== $data = 'gbookdb.txt'; # path for data file $title = 'Гасцёўня праекту "Arfabel"'; # page title $bgcolor = 'bbbbc7'; # background color $display = '10'; # default # of entries to display per page $fsize = '2'; # font size #$fface = 'Arial'; # font face $fcolor = '007080'; # font color $fcolorc = '000000'; # comment font color $alink = '0033ff'; # link color $avisited = '007080'; # visited link color $ahover = 'ff0000'; # hover link color $twidth = '650'; # table width $talign = 'center'; # table align (left/right/center) $tborder = '1'; # table border size $tbcolor = '999999'; # table border color $tpadding = '5'; # table padding size $tspacing = '1'; # table spacing size $tcolor1 = 'eeeef7'; # table color 1 $tcolor2 = 'e5e5f1'; # table color 2 $maxcomlen = '2000'; #maximal lent of comment field #======================================== # NO EDITING AFTER THIS LINE #======================================== #======================================== # Solve and Set Query String #======================================== if ($ENV{'QUERY_STRING'}) { ($s1,$s2,$s3,$s4) = split(/\&/,$ENV{'QUERY_STRING'}); ($type1,$value1) = split(/\=/,$s1); ($type2,$value2) = split(/\=/,$s2); ($type3,$value3) = split(/\=/,$s3); ($type4,$value4) = split(/\=/,$s4); $start = $value1; $sort = $value2; $display = $value3; $search = $value4; } else { $start = 0; $sort = lifo; } $stop = $start + $display; #======================================== # Open Data File and Sort #======================================== open(temp,"$data"); flock(temp, 2); @indata = ; if ($sort eq lifo) { @datass = reverse(@indata); } elsif ($sort eq lilo) { @datass = @indata; } elsif ($sort eq name) { @datass = sort(@indata); } close(temp); #======================================== # Count Total #======================================== open(file,"$data"); while() { $TheLine = $_; chomp($TheLine); $LineCount = $LineCount + 1; } close(file); #======================================== # Print Page Header #======================================== print "Content-Type: text/html\n\n"; print qq~ $title ~; print qq~
$title

Усіх - $LineCount запісаў

Пакінуць запіс Галоўная старонка праекту
Паказваць на старонцы
Сартаваць
\n\n"; #======================================== # Format and Display Entries #======================================== print "
\n\n"; $match = $start; $matchcount = 0; for($i = $start; $match < $stop && $i < $LineCount; $i++) { $newdata = $datass[$i]; ($name,$email,$UIN,$url,$place,$comment,$date) = split(/\|\|/,$newdata); if ($name =~ /$search/i) { $match++; $lastmatch = $i; $matchcount++; print "\n\n" if ($name); } } #======================================== # No Matching Entry #======================================== if ($matchcount == 0) { print qq~ ~; } #======================================== # Check for Next Matches #======================================== $morematch = 0; $findstart = $lastmatch + 1; for($i = $findstart; $i < $LineCount; $i++) { $newdata = $datass[$i]; ($name,$email,$UIN,$url,$place,$comment,$date) = split(/\|\|/,$newdata); if ($name =~ /$search/i) { $morematch++; } } #======================================== # Check for Prev Matches #======================================== $prevmatch = 0; $prevstart = $start - 1; for($i = $prevstart; $i >= 0 && $prevmatch < $display; $i--) { $newdata = $datass[$i]; ($name,$email,$UIN,$url,$place,$comment,$date) = split(/\|\|/,$newdata); if ($name =~ /$search/i) { $prevmatch++; $previndex = $i; } } #======================================== # Display Next and Prev Links #======================================== print "
\n" if ($name); print "\n" if ($name); print "$name
\n" if ($name); print " \n" if($url); print " \n" if($UIN); print "
$place\n" if($place); print "
$date" if ($name); print "
\n" if ($name); print "$comment\n" if($comment); print "
No matching entry found!
\n\n"; print "
\n"; print "\n"; print "" if ($start > 0 && $prevmatch > 0); print "" if ($morematch > 0); print "
Папярэднія $displayНаступныя $display
\n"; print qq~

powered by leungeric.com ~; print "