|
|
|
|
validate($random_string))
{ echo '!! You cannot use the same captcha image twice, please try again. '; }
# Check, that the right CAPTCHA password has been entered and
# return an error message otherwise.
elseif (!$captchas->verify($password))
{ echo '!! You entered the wrong text from the image. Please try again. '; }
# everything is OK if we get here, so add message
else
{
# english dating dd/mm/yyy
$date = date("n/j/Y");
$new_id = count($guestbook['guestbook']['entry']) + 1;
$message = implode(' ', explode("\n",$_POST['message']));
$new_entry = "\t
$date
{$_POST['name']}
$message
\n";
# file returns and array: one element per file line
$gb_file = file($guestbook_xml);
# the last line of the xml file is the closing guestbook tag, take it out
# so that we just append the new entry (which has the closing tag)
array_pop($gb_file);
# collapse the file array and append the new entry
$gb_file = implode('',$gb_file).$new_entry;
# write the few xml file to the file
file_put_contents($guestbook_xml,$gb_file);
$guestbook['guestbook']['entry'][] = array( 'id' => $new_id,
'date' => $date,
'name' => $_POST['name'],
'message' => $message );
# the message and name are always printed back into the form
# but we only want this if the captcha failed
# if we're here, the captcha was successful, so we clear these values
$_POST['message'] = '';
$_POST['name'] = '';
}
}
?>
|
0)
{
$previous_page = $page - 1;
print "newer entries";
}
?>
|
older entries";
}
?>
|
|
|
|
|
|
|
|