initial commit
This commit is contained in:
241
archive/version_02/de/guestbook.php
Executable file
241
archive/version_02/de/guestbook.php
Executable file
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
include '../php/CaptchasDotNet.php';
|
||||
|
||||
# create the captcha object to display one and validate one if a post
|
||||
# is being added
|
||||
$captchas = new CaptchasDotNet ('bramey', 'vgcR8s11vH8bQZIsPISiiCCu3buXgCVkV4AOdRmV',
|
||||
'../captchas/captchasnet-random-strings','1800',
|
||||
'abcdefghkmnopqrstuvwxyz','6',
|
||||
'200','80');
|
||||
?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>The International Jairus Society</title>
|
||||
|
||||
<link href="../jairus_index.css" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="../random_images.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="../jairus.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main_div" align="center">
|
||||
<div id="logo_img"><img src="graphics/Jairus_Logo_d.jpg" width="160" height="215" /></div>
|
||||
<div id="logo_text" align="center">
|
||||
<img src="graphics/jairus_logotext_de.jpg" align="top" />
|
||||
</div>
|
||||
|
||||
<div id="header" align="center"></div>
|
||||
|
||||
<div id="main_links_div" align="center">
|
||||
<a href="index.htm"><img src="graphics/home_btn.gif" name="home_btn" border="0" id="home_btn"
|
||||
onmouseover="Swap( 'home', 1 );" onmouseout="Swap( 'home', 0 );" /></a>
|
||||
<a href="uberuns.htm"><img src="graphics/ourmission_btn.gif" name="ourmission_btn" border="0" id="ourmission_btn"
|
||||
onmouseover="Swap( 'ourmission', 1 );" onmouseout="Swap( 'ourmission', 0 );" /></a>
|
||||
<a href="familien.htm"><img src="graphics/ourfamilies_btn.gif" name="ourfamilies_btn" border="0" id="ourfamilies_btn"
|
||||
onmouseover="Swap( 'ourfamilies', 1 );" onmouseout="Swap( 'ourfamilies', 0 );" /></a>
|
||||
<a href="helfen.htm"><img src="graphics/support_btn.gif" name="support_btn" border="0" id="support_btn"
|
||||
onmouseover="Swap( 'support', 1 );" onmouseout="Swap( 'support', 0 );" /></a>
|
||||
<a href="rechtliches.htm"><img src="graphics/legal_btn.gif" name="legal_btn" border="0" id="legal_btn"
|
||||
onmouseover="Swap( 'legal', 1 );" onmouseout="Swap( 'legal', 0 );" /></a>
|
||||
<a href="kontakt.htm"><img src="graphics/contactus_btn.gif" name="contactus_btn" border="0" id="contactus_btn"
|
||||
onmouseover="Swap( 'contactus', 1 );" onmouseout="Swap( 'contactus', 0 );" /></a>
|
||||
<a href="guestbook.pl"><img src="graphics/guestbook_btn_2.gif" name="guestbook_btn" border="0" id="guestbook_btn"
|
||||
/></a>
|
||||
<a href="links.htm"><img src="graphics/links_btn.gif" name="links_btn" border="0" id="links_btn"
|
||||
onmouseover="Swap( 'links', 1 );" onmouseout="Swap( 'links', 0 );" /></a>
|
||||
</div>
|
||||
<table cellpadding="0" cellspacing="0" id="content_table">
|
||||
<tr>
|
||||
<td class="top_left_corn"></td>
|
||||
<td class="horz_top"></td>
|
||||
<td class="top_right_corn"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="vert_left"></td>
|
||||
<td align="left">
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="page_content_cell">
|
||||
<!--BEGIN_CONTENT-->
|
||||
<span class="header">Gästebuch</span>
|
||||
<br /> <br />
|
||||
<span class="body_text">
|
||||
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
include '../php/func_xml.php';
|
||||
|
||||
$guestbook_xml = './guestbook.xml';
|
||||
$guestbook = xml_parse_file($guestbook_xml);
|
||||
|
||||
if($_POST['cmd'] == 'add')
|
||||
{
|
||||
$random_string = $_POST['captcha_random'];
|
||||
$message = $_POST['message'];
|
||||
$password = $_POST['captcha_password'];
|
||||
# Check the random string to be valid and return an error message
|
||||
# otherwise.
|
||||
if (!$captchas->validate($random_string))
|
||||
{ echo '!! You cannot use the same captcha image twice, please try again.<hr />'; }
|
||||
|
||||
# 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.<hr />'; }
|
||||
|
||||
# everything is OK if we get here, so add message
|
||||
else
|
||||
{
|
||||
# english dating dd/mm/yyy
|
||||
$date = date("j/n/Y");
|
||||
$new_id = count($guestbook['guestbook']['entry']) + 1;
|
||||
$message = implode('<br />', explode("\n",$_POST['message']));
|
||||
$new_entry = "\t<entry id='$new_id'>
|
||||
<date>$date</date>
|
||||
<name>{$_POST['name']}</name>
|
||||
<message>$message</message>
|
||||
</entry>\n</guestbook>";
|
||||
|
||||
# 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'] = '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<form action="guestbook.php" method="post" onsubmit="return Check_GB_Fields();">
|
||||
<input type='hidden' name='cmd' value='add' />
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
Name:</td>
|
||||
<td valign="top" align="left">
|
||||
<input type="text" size="30" name="name" id="name" value='<?php echo $_POST['name']?>' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right">
|
||||
Nachricht:</td>
|
||||
<td valign="top" align="left" style="padding-bottom: 15px;">
|
||||
<input type="hidden" name="captcha_random" value="<?php echo $captchas->random() ?>" />
|
||||
<textarea rows="4" cols="40" name="message" id="message"><?php echo $_POST['message']?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right"> </td>
|
||||
<td valign="top" align="left" style="padding-bottom: 15px;">
|
||||
Bitte gib den Text vom Bild ein:<br />
|
||||
<input type='text' name='captcha_password' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right"> </td>
|
||||
<td valign="top" align="left" style="padding-bottom: 15px;">
|
||||
<?php echo $captchas->image() ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align="left">
|
||||
<input name="submit" type="submit" id="submit" value="Add Entry" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
|
||||
<?php
|
||||
|
||||
$page = $_GET['page'] ? $_GET['page'] : 1;
|
||||
$start_at = ($page - 1) * 10;
|
||||
$entries = array_reverse($guestbook['guestbook']['entry']);
|
||||
for($c = $start_at; $c <= $start_at + 9; $c++)
|
||||
{
|
||||
if(!array_key_exists($c,$entries))
|
||||
{ break; }
|
||||
|
||||
?>
|
||||
<div class="guestbook_entry">
|
||||
<div class="guestbook_header"><?php echo "{$entries[$c]['name']} || {$entries[$c]['date']}" ?></div>
|
||||
<span class="gb_text"><?php echo $entries[$c]['message'] ?></span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellpadding='2' cellspacing='0' border='0' width='100%'>
|
||||
<tr>
|
||||
<td align='left'>
|
||||
<?php
|
||||
|
||||
if($start_at > 0)
|
||||
{
|
||||
$previous_page = $page - 1;
|
||||
print "<a href='guestbook.php?page={$previous_page}'>neue einträge</a>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td align='right'>
|
||||
<?php
|
||||
|
||||
if(array_key_exists($start_at + 10, $entries))
|
||||
{
|
||||
$next_page = $page + 1;
|
||||
print "<a href='guestbook.php?page={$next_page}'>alte einträge</a>";
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
<!--END_CONTENT-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="vert_right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom_left_corn"></td>
|
||||
<td class="horz_bottom"></td>
|
||||
<td class="bottom_right_corn"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" -->
|
||||
<script type="text/javascript" language="JavaScript">var site="s20fmont"</script>
|
||||
<script type="text/javascript" language="JavaScript1.2" src="http://s20.sitemeter.com/js/counter.js?site=s20fmont">
|
||||
</script>
|
||||
<noscript>
|
||||
<a href="http://s20.sitemeter.com/stats.asp?site=s20fmont" target="_top">
|
||||
<img src="http://s20.sitemeter.com/meter.asp?site=s20fmont" alt="Site Meter" border="0"/></a>
|
||||
</noscript>
|
||||
<!-- Copyright (c)2005 Site Meter -->
|
||||
<!--WEBBOT bot="HTMLMarkup" Endspan -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user