Tiny Smart Guest Book (tsgb) version 1.0 @ $sitename"; $style=""; $msgframe1="
 
"; $msgframe2="
 
"; if ($n && $c ) { $e=str_replace('<','<',$e); $e=stripslashes($e); $e=substr($e,0,32); $n=str_replace('<','<',$n); $n=stripslashes($n); $n=substr($n,0,32); $c=str_replace('<','<',$c); $c=stripslashes($c); $c=preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i", "
$1",$c); $c=eregi_replace("\n",'
',$c); $file="$dir/0"; if ( $id >= $maxmsgs ) { $date=date("Yjdhi"); rename("$dir/$maxpage","$dir/archive.$date"); while($maxpage) { $maxpage--; $newpage=$maxpage+1; #echo "rename(\"$dir/$maxpage\",\"$dir/$newpage)"; rename("$dir/$maxpage","$dir/$newpage"); } } if ( !$id || $id >= $maxmsgs ) $id=0; $date = date( "l, F j Y, h:i a"); $m="
           From: $n Email: $e $date top 
 
    $c
  
\n"; # Version 2 insert the new message at the top # $fp = fopen ($file,"r+"); $current = fread($fp,filesize($file)); $current = eregi_replace('<\? \$id=[0-9]*; \?>','',$current); fseek($fp,0); fputs($fp,"$m\n$current"); # Version 1 append the new message at the end # # $fp = fopen($file,"a"); # fwrite ($fp, $m); fclose ($fp); header("Location: ./"); } else { $i=0;$j=1; while(1) { if ( file_exists("$dir/$j") ) $j++; else break; } $head ="
G u e s t B o o kpage: "; while($i<$j){ if ($i == $page ) $head .="$i "; else $head .="$i "; $i++; } $head .=" 

"; echo $style; echo $head; if ( $page && file_exists("$dir/$page")){ echo $msgframe1; include "$dir/$page"; echo $msgframe2; }else{ if ( file_exists("$dir/0") ){ echo $msgframe1; include "$dir/0"; echo $msgframe2; $id++; } else { $fh=fopen("$dir/0","a+"); fclose($fh); $id=0; } } $out .="
Your comments, suggestions, feedbacks are wellcome.
$sitename
NAME:  EMAIL:
COMMENTS:

"; if ( !$page ) echo $out; } echo $version; ?>