#!/usr/bin/perl print "Content-type: text/html\n\n"; @pairs = split(/&/, $ENV{'QUERY_STRING'}); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $FORM{$name} = $value; } $n = $FORM{'n'}; require "gb.cfg"; # require "cookie.lib"; # &SetCookiePath($gb_url_path); # &GetCompressedCookies($gb_name); # $FORM{'realname'} = $Cookies{'pronet_name'}; # $FORM{'username'} = $Cookies{'pronet_mail'}; # $FORM{'www'} = $Cookies{'pronet_www'}; require "html.cfg"; open(FILE, $gb_path); @intests = ; close(FILE); $max_rec = 0; foreach $intest (@intests) { chomp($intest); if ($intest) { $max_rec++; $rec[$max_rec] = $intest; } } #@rec = reverse (@rec); $begin = $n; if ($n eq "") {$begin = $max_rec}; if ($n > $max_rec) {$begin = $max_rec}; if ($n < 1) {$begin = $max_rec}; $l = $begin - $max_lines + 1; if ($begin <= $max_lines) {$l = 1;} #Нав-бар if ($begin > $max_lines) { $next_v = $begin - $max_lines; $next = " $string_prev"; } $test = $max_rec - $begin; $prev_v = $begin + $max_lines; if ($test < $max_lines) {$prev_v = $nomer}; if ($test != 0) { $prev = "$string_next "; } if ($next) { if ($prev) {$razdelitel = $string_sep} } $diap = "$string_recs $l - $begin"; if ($begin == 1) {$diap = "$string_rec 1";} if ($begin == 0) {$diap = "$string_no_recs";} for ($i = $begin; $i >= $l; $i= $i - 1) { ($r_id, $r_ip, $r_time, $r_name, $r_mail, $r_www, $r_text, $r_domain, $r_reply, $r_tit) = split(/\|/, $rec[$i]); # Convert data file if it is in the old format if ($r_ip) { $miss = 0; if ($r_id =~ /\D/) {$miss = 1;} if ($miss == 1) {&convert;} } ($r_test, $r_day, $r_month, $r_year, $r_hour, $r_min) = split(/\//, $r_time); # Remeber time once more for later use $l_time = $r_time; $c_month = $months[$r_month]; $r_time = $c_time; $r_time =~ s/DAY/$r_day/g; $r_time =~ s/MONTH/$c_month/g; $r_time =~ s/YEAR/$r_year/g; $r_time =~ s/HOUR/$r_hour/g; $r_time =~ s/MIN/$r_min/g; if ($r_test ne "dt") {$r_time = $l_time}; $v_mail = "$r_name"; if ($r_mail eq "") {$v_mail=$r_name}; if ($r_www ne "") {$r_name = "$r_www"}; if ($r_www eq "") {$r_name = ""}; $rec_name2 = $rec_name; $rec_date2 = $rec_date; $rec_comments2 = $rec_comments; $rec_tit2 = $rec_tit; $rec_master_reply2 = ""; if ($r_reply) {$rec_master_reply2 = $rec_master_reply;} if ($check_master) { if ($r_mail eq $master_mail) { foreach $master_ip (@master_ips) { if ($r_ip =~ /$master_ip/i) {$rec_comments2 = $rec_master_comments;} } } } $rec_name2 =~ s/!!/$v_mail $r_name/g; $rec_date2 =~ s/!!/$r_time/g; $rec_comments2 =~ s/!!/$r_text/g; $rec_tit2 =~ s/!!/$r_tit/g; if ($r_reply) {$rec_master_reply2 =~ s/!!/$r_reply/g;} $all .= qq~ \n \n \n \n
$rec_name2 $rec_tit2
$rec_comments2 $rec_master_reply2
$rec_date2
\n $separator ~; } $rec_final = "$rec_nav_1$next$razdelitel$prev$rec_nav_2"; $all = "$all$rec_final"; #"$forma\n$all$rec_final"; $title2 = "$diap - $title"; $header =~ s/!!/ $diap./g; print " $title2 \n \n \n "; print "$TOP"; print "$header"; print "$all\n"; print "$BOTTOM"; # D O N E ! exit; sub convert { open(CONV, $gb_path); @inconv = ; close(CONV); open(CONV, ">$gb_path"); $ct = 0; foreach $conv (@inconv) { print CONV "$ct|$conv"; $ct++; } print "\n"; print "\nUpdated!\n\n\n"; print "

Updated!

"; print "The new version of guestbook was installed, so the data file ($gb_path) was converted to the new format.
\n"; print "Please click \"Reload\" button of your browser to refresh the page.
\n"; print "\n"; close(CONV); exit; }