(Add your name)

"; if ($total== 0) { print "

At the moment there are no persons in the guestbook.


"; } elseif ($total> 0) { /* default */ $counter=0; if ($dir=="") $dir="Next"; $lpp = $records; if ($offset==0) $offset=0; if ($dir=="Next") { if ($total > $lpp) { $counter=$offset; $offset+=$lpp; $num=$offset; if ($num > $total) { $num=$total; } } else { $num=$total; } } elseif ($dir=="Previous") { if ($total > $lpp) { $offset-=$lpp; if ($offset < 0) { $offset=0; } $counter=$offset-$lpp; if ($counter < 0) $counter=0; $num=$counter+$lpp; } else { $num=$total; } } while ($counter < $num) { $j=0; $j=$counter + 1; /* now really grab the data */ $i1=mysql_result($result,$counter,"name"); $i2=mysql_result($result,$counter,"email"); $i3=mysql_result($result,$counter,"job"); $i4=mysql_result($result,$counter,"comments"); $i4 = stripslashes ("$i4"); /* print it in a nice layout */ print "
\n"; print "
\n"; print "
\n"; print "Name: $i1\n"; print "
Job: $i3\n"; print "
Comment:\n"; print "
$i4\n"; print "
\n"; print "
\n"; $counter++; } } mysql_close(); } /* execute the function */ search_it($name); /* See if we need to put on the NEXT or PREVIOUS buttons */ if ($total > $lpp) { echo("
\n"); /* See if we need a PREVIOUS button */ if ($offset > $lpp) { echo("\n"); } /* See if we need a NEXT button */ if ($offset < $total) { echo("\n"); } echo("\n"); echo("\n"); echo("
"); } } /* action=add : show a form where the user can enter data to add to the database */ elseif($action == "add") { ?>
Please take your time to enter something
[required fields are marked with *]

Name *
Job *
Email *
Comments *
 
0) { ?>
Please take your time to enter something
[you forgot some fields (marked with *)]

Name *
Job *
Email *
Comments *
 
","PHP3 Guestbook Addition","
$form[name] ($form[email]) wrote the following message in the guestbook :
  
$form[comments] 
  
Name:$form[name]
Beroep:$form[job]
Email:$form[email]
", "From: $form[name] <$form[email]>\nReply-To: $form[name] <$form[email]>\nContent-type: text/html\nX-Mailer: PHP/" . phpversion()); } else { mail("$admin_mail","PHP3 Guestbook Addition","$form[name] ($form[email]) wrote the following message in the guestbook : \n\n $form[comments]\n\n Name: $form[name] \n Job: $form[job] \n Email: $form[email] \n", "From: $form[name] <$form[email]>\nReply-To: $form[name] <$form[email]>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion()); } /* MySQL really hates it when you try to put things with ' or " characters into a database, so strip these...*/ $form[comments] = addslashes ("$form[comments]"); $query = "INSERT INTO $table VALUES('','$form[name]', '$form[email]', '$form[job]', '$form[comments]')"; $result = MYSQL_QUERY($query); ?>

Thank you, , for adding your name to our guestbook.

View your comment now.


"; echo "

$entry in the guestbook.
"; echo "

Add your name to our guestbook

"; if ($number > "") { echo "

View the names in our guestbook

"; } echo ""; } ?>
Script by Advanced IT Services Holland