Guestbook
\nQuery failed\n$query\n" . mysql_error() . "\nWelcome to the guestbook of the ISRA Great Bears. The Great Bears are not responsible for any content contained herein, nor on any links which have been submitted. If you find an entry to be inappropriate, please contact the webmaster.
| [No Email] | ">[Email] | [No Homepage] | [Homepage] | ||
To return to our Guestbook, simply click here.
New Entry
Debug:\n Name: [$name]\n Email: [$email]\n" .
" Homepage: [$homepage]\n Entry: [$entry]\n");
*/
$resp = recaptcha_check_answer(null,
$_SERVER['REMOTE_ADDR'],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if( !$resp->is_valid )
{
echo "\n"; echo "The reCAPTCHA wasn't entered correctly - please try again.\n"; echo "
"; $err++; } if( empty($name) ) { echo "\n"; echo "Your name cannot be empty!\n"; echo "
"; $err++; } if( empty($entry) ) { echo "\n"; echo "Your entry cannot be empty!\n"; echo "
"; $err++; } if( $err > 0 ) { /* Update globals and exit */ global $fName; global $fEmail; global $fHomepage; global $fEntry; global $reCaptchaError; $fName=$name; $fEmail=$email; $fHomepage=$homepage; $fEntry=$entry; $reCaptchaError=$resp->error; return 1; } $link = connect_db(); if( !$link ) { echo "\n";
echo "Error connecting to database: " . mysql_error() . "\n";
echo "
";
echo "Your entry was not saved. Please notify the administrator with the error.\n";
echo "
DEBUG: query = $query\n";*/ if( mysql_query($query) == FALSE ) { print("
Query failed:\n[" . $query . "]\nError: " . mysql_error() . "\n"); return 2; } else { mail( "webmaster@greatbears.org.uk", "New Guestbook Entry", "You have a new Guestbook entry:\n" . "From: $name at ".$_SERVER['REMOTE_ADDR']."\n" . "Content: $entry\n" ); } return 0; } /* Main Logic for this page fSubmitted = 0 - display listing fSubmitted = 1 - display welcome page with new entry form fSubmitted = 2 - user clicked on 'Submit', save data; on success display guestbook entries, on failure, re-display edit form. */ if( $fSubmitted==2 ) { $fSubmitted=SaveNewEntry($fName,$fEmail,$fHomepage,$fEntry); } if( $fSubmitted==1 ) { EditNewEntry($fName,$fEmail,$fHomepage,$fEntry); } if( $fSubmitted==0 ) { DisplayGuestbook(); } ?>