"; $paginatie = ""; if ($_SERVER['REQUEST_METHOD']=='POST'){ if (!$_POST['name'] OR !$_POST['comments']) { $content .= ""; } else { $date = time(); $name = stripslashes($_POST['name']); $email = stripslashes($_POST['email']); $url = stripslashes($_POST['url']); $comments = stripslashes($_POST['comments']); $query = mysql_query("INSERT INTO guestbook VALUES( 'NULL', '".$date."', '".$name."', '".$email."', '".$url."', '".$comments."' ) ") or die(mysql_error()); echo ""; } } if (mysql_num_rows($query) > 0 ){ //create pages $pg = empty($_GET['pg']) ? 1 : $_GET['pg']; $catePePag = "10"; // no of items per page $nrIntrari = mysql_num_rows($query); $rest = ($nrIntrari % $catePePag); $nrPag = IntVal($nrIntrari / $catePePag); $paginatie = "Page: "; if ($rest <> 0) $nrPag = $nrPag + 1; for ($i=1; $i<=$nrPag; $i++) { if ($i == $pg) $paginatie .=" ".$i." "; else $paginatie .= "".$i." "; } if ((!intval($pg)) or ($pg > $nrPag)) echo ""; $content .= "\n

Guestbook items

"; $content .= "
"; $content .= $paginatie; $content .= "
"; if ($pg == 1) $inf = 0; else $inf = $catePePag * ($pg-1); $intrariPag = mysql_query("SELECT * FROM guestbook ORDER BY id DESC LIMIT " . $inf . ",". $catePePag. "") or die(mysql_error()); //end of pagination for($i=0; $i"; $content .= "
Name
".mysql_result($intrariPag,$i,'name')."
"; if (mysql_result($intrariPag,$i,'email')) $content .= "
E-mail
".mysql_result($intrariPag,$i,'email')."
"; if (mysql_result($intrariPag,$i,'url') != "http://") $content .= "
URL
".mysql_result($intrariPag,$i,'url')."
"; $content .= "
Comments
".mysql_result($intrariPag,$i,'comments')."
"; $content .= "\n"; $content .= "
 
"; if ($i != mysql_num_rows($intrariPag)-1) $content .= "
"; else $content .= "

 

"; } } else { $content .= "\n

Guestbook items

"; $content .= "\n

Nobody signed the guestbook yet!

"; } $content .= "
"; $content .= $paginatie; $content .= "
"; $content .= "
 
"; $content .= "\n

Sign the guestbook

"; $content .= "\n
"; $content .= "\n
"; $content .= "
Name
*
"; $content .= "
E-mail
"; $content .= "
URL
"; $content .= "
Comments
*
"; $content .= "
 
"; $content .= "\n
"; //Please do not erase the line below. Leave the copyright intact. Thank you $content .= "

Guestbook v1.0 · © 2005 Armand Niculescu

"; $content .= ""; print $content; ?>