<?php session_start(); require('connection.inc.php'); ?>
<html>
<head>
<title>design2</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.gbEntry {
width: 85%;
margin: 15px auto;
border: 1px solid #111;
}
.gbEntry a {
color: #FFF;
text-decoration: underline;
}
.gbEntry a:hover {
text-decoration: none;
color: #FAFAFA;
}
.gbContent {
background: #FAFAFA url('../styled/img/gbContentBg.png') top left repeat-x;
color: #000000;
min-height: 75px;
padding: 5px 10px 5px 10px;
}
.gbDetails {
background: #FF00D8;
padding: 3px;
font-size: 14px;
font-style: normal;
color: #FFF;
border-bottom: 1px solid #1D719F;
}
body {
background-color: #FF00D8;
}
body,td,th {
font-family: Arial;
font-size: 10pt;
color: #000000;
}
a:link {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
.stijl1 {
font-size: 10px;
color: #FFFFFF;
}
.stijl2 {color: #000000}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (design2.psd) -->
<table id="Tabel_01" width="1082" height="769" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="7">
<img src="afbeeldingen/Index_01.jpg" width="1082" height="74" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2">
<img src="afbeeldingen/Index_02.jpg" width="412" height="47" alt=""></td>
<td width="217" height="31" bgcolor="#FFFFFF"> <div class="action">
<div align="center"><a href="?action=addComment">Plaats Bericht</a></div></td>
<td rowspan="2">
<img src="afbeeldingen/Index_04.jpg" width="39" height="47" alt=""></td>
<td width="211" height="31" bgcolor="#FFFFFF"><div align="center"><a href="?action=viewComments">Alle Berichten</a> </div></td>
<td colspan="2" rowspan="2">
<img src="afbeeldingen/Index_06.jpg" width="203" height="47" alt=""></td>
</tr>
<tr>
<td>
<img src="afbeeldingen/Index_07.jpg" width="217" height="16" alt=""></td>
<td>
<img src="afbeeldingen/Index_08.jpg" width="211" height="16" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="afbeeldingen/Index_09.jpg" width="301" height="647" alt=""></td>
<td height="609" colspan="5" align="left" valign="top" bordercolor="#FF00FF" bgcolor="#FFFFFF">
<?php
#######################################
## © 2008 Wouter De Schuyter (Paradox)
## <[email protected]>
## http://paradox-productions.net/
## GUESTBOOK V1.0 (SPAM PROTECTED)
#######################################
// SET VARIABLES
//////////////////
$minName = 1; // minimum lenght name
$maxName = 100; // maximum lenght name
$minEmail = 1; // minimum lenght email
$maxEmail = 256; // maximum lenght email
$minMessage = 1; // minimum lenght message
$maxMessage = 2560; // maximum lenght message
///////////////////
$act = $_GET['action'];
// FUNCTIONS
//////////////
// REPLACE TEXT BY EMOTICONS
function emoticons($string) {
$array1 = array(
'^^',
'(!)',
'(?)',
'(A)',
'(a)',
':)',
'=)',
'(:',
'(=',
'):',
')=',
':(',
'=(',
';)',
':d',
':D',
'=d',
'=D',
':p',
':P',
'=p',
'=P',
'(8)',
':s',
':S',
'=s',
'=S',
's:',
'S:',
's=',
'S=',
':o',
':O',
'=o',
'=O',
'o:',
'O:',
'o=',
'O=',
'(l)',
'(L)',
':$',
'=$',
'$:',
'$=',
':\'(',
'=\'(',
')\'=',
')\':',
':@',
'=@',
' >< ',
'><\'',
'-_-',
'-.-',
'f5'
);
$array2 = array(
'<img src="img/emoticons/happy.gif" alt="Emoticon" />',
'<img src="img/emoticons/exclamationmark.gif" alt="Emoticon" />',
'<img src="img/emoticons/questionmark.gif" alt="Emoticon" />',
'<img src="img/emoticons/angel.png" alt="Emoticon" />',
'<img src="img/emoticons/angel.png" alt="Emoticon" />',
'<img src="img/emoticons/smile.gif" alt="Emoticon" />',
'<img src="img/emoticons/smile.gif" alt="Emoticon" />',
'<img src="img/emoticons/smile.gif" alt="Emoticon" />',
'<img src="img/emoticons/smile.gif" alt="Emoticon" />',
'<img src="img/emoticons/sad.gif" alt="Emoticon" />',
'<img src="img/emoticons/sad.gif" alt="Emoticon" />',
'<img src="img/emoticons/sad.gif" alt="Emoticon" />',
'<img src="img/emoticons/sad.gif" alt="Emoticon" />',
'<img src="img/emoticons/wink.gif" alt="Emoticon" />',
'<img src="img/emoticons/biggrin.gif" alt="Emoticon" />',
'<img src="img/emoticons/biggrin.gif" alt="Emoticon" />',
'<img src="img/emoticons/biggrin.gif" alt="Emoticon" />',
'<img src="img/emoticons/biggrin.gif" alt="Emoticon" />',
'<img src="img/emoticons/tongue.gif" alt="Emoticon" />',
'<img src="img/emoticons/tongue.gif" alt="Emoticon" />',
'<img src="img/emoticons/tongue.gif" alt="Emoticon" />',
'<img src="img/emoticons/tongue.gif" alt="Emoticon" />',
'<img src="img/emoticons/bandit.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/confused.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/ooo.gif" alt="Emoticon" />',
'<img src="img/emoticons/heart.gif" alt="Emoticon" />',
'<img src="img/emoticons/heart.gif" alt="Emoticon" />',
'<img src="img/emoticons/blush.gif" alt="Emoticon" />',
'<img src="img/emoticons/blush.gif" alt="Emoticon" />',
'<img src="img/emoticons/blush.gif" alt="Emoticon" />',
'<img src="img/emoticons/blush.gif" alt="Emoticon" />',
'<img src="img/emoticons/crying.gif" alt="Emoticon" />',
'<img src="img/emoticons/crying.gif" alt="Emoticon" />',
'<img src="img/emoticons/crying.gif" alt="Emoticon" />',
'<img src="img/emoticons/crying.gif" alt="Emoticon" />',
'<img src="img/emoticons/angry.gif" alt="Emoticon" />',
'<img src="img/emoticons/angry.gif" alt="Emoticon" />',
' <img src="img/emoticons/hmmpff.gif" alt="Emoticon" /> ',
'<img src="img/emoticons/hmmpff.gif" alt="Emoticon" />',
'<img src="img/emoticons/hmmpff.gif" alt="Emoticon" />',
'<img src="img/emoticons/hmmpff.gif" alt="Emoticon" />',
'<img src="img/emoticons/hmmpff.gif" alt="Emoticon" />'
);
$output = str_replace($array1, $array2, $string);
return $output;
}
// UBB CODE
function ubb($string) {
$array1 = array(
'[b]',
'[/b]',
'[u]',
'[/u]',
'[center]',
'[/center]',
'[i]',
'[/i]'
);
$array2 = array(
'<b>',
'</b>',
'<u>',
'</u>',
'<center>',
'</center>',
'<i>',
'</i>'
);
$output = str_replace($array1, $array2, $string);
return $output;
}
// VALID
function valid($string) {
$array1 = array(
'<br>'
);
$array2 = array(
'<br />'
);
$output = str_replace($array1, $array2, $string);
return $output;
}
// WHEN ACTION IS "Add Comment"
if($act == "addComment") {
echo "<h3>Plaats Bericht</h3>\n";
if($_SERVER['REQUEST_METHOD'] == "POST") {
$name = addslashes(ucfirst(trim($_POST['name']))); // NAME
$email = addslashes($_POST['email']); // EMAIL
$showEmail = $_POST['showEmail']; // SHOW/HIDE EMAIL
$emoticons = $_POST['emoticons']; // ENABLE/DISABLE EMOTICONS
$message = addslashes(ucfirst(trim($_POST['message']))); // MESSAGE
$captcha = $_POST['captcha']; // CAPTCHA
$captchaVer = $_SESSION['captcha']; // CAPTCHA CHECK
$time = date("Y/m/d H:i:s"); // TIME
$ip = $_SERVER['REMOTE_ADDR']; // IP
$regexp = "/^[a-z0-9_]+([_\\.-][a-z0-9_]+)*@([a-z0-9_]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i"; // EMAIL CHECK
// GENERAL FIELD CHECK
if(empty($name) or empty($email) or empty($message) or empty($captcha)) {
echo "<p>Make sure all the required fields are correctly filled in!</p>\n";
$generalError = true;
}
elseif($generalError !== true) {
// CHECK NAME LENGHT
if(strlen($name) < $minName) {
echo "<p>Your name must contain at least " . $minName . " characters! Please enter a longer name.</p>\n";
$lenghtError = true;
}
elseif(strlen($name) > $maxName) {
echo "<p>Your name can not contain more than " . $maxName . " characters! Please enter a shorter name.</p>\n";
$lenghtError = true;
}
// CHECK EMAIL LENGHT
if(strlen($email) < $minEmail) {
echo "<p>Your email must contain at least " . $minEmail . " characters! Please enter a longer email.</p>\n";
$lenghtError = true;
}
elseif(strlen($email) > $maxEmail) {
echo "<p>Your email can not contain more than " . $maxEmail . " characters! Please enter a shorter email.</p>\n";
$lenghtError = true;
}
// CHECK MESSAGE LENGHT
if(strlen($message) < $minMessage) {
echo "<p>Your message must contain at least " . $minMessage . " characts! Please enter a longer messageer.</p>\n";
$lenghtError = true;
}
elseif(strlen($message) > $maxMessage) {
echo "<p>Je bericht is meer dan " . $maxMessage . " tekens! Schrijf een korter bericht.</p>\n";
$lenghtError = true;
}
// CHECK CAPTCHA LENGHT
if(strlen($captcha) !== 4) {
echo "<p>De verifiëercode moet meer dan 4 tekens bevatten!</p>\n";
$lenghtError = true;
}
if($lenghtError !== true) {
// VALID EMAIL ?
if(!preg_match($regexp, $email)) {
echo "<p>Je e-mail is incorrect probeer opnieuw.</p>\n";
$error = true;
}
// CAPTCHA CORRECT?
if($captcha !== $captchaVer) {
echo "<p>De verifiëercode is verkeerd.</p>\n";
$error = true;
}
if($error !== true) {
$insertQuery = "INSERT INTO `guestbook` (`name`, `email`, `showEmail`, `enableEmoticons`, `message`, `time`, `ip`) VALUES ('" . $name . "', '" . $email . "', '" . $showEmail . "', '" . $emoticons . "', '" . $message . "', '" . $time . "', '" . $ip . "')";
$insert = mysql_query($insertQuery);
if($insert) {
echo "<p>Je bericht is succesvol geplaatst!<br /><a href=\"?action=viewComments\">Klik hier</a> om je bericht te zien.</p>\n";
$success = true;
}
else {
echo "<p>Error<br />" . mysql_error() . "</p>\n";
}
}
}
}
}
if($success !== true) {
?>
<div class="innerContainer">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $act; ?>" method="post">
<table>
<tr>
<td>Naam:</td>
<td><input type="text" name="name" maxlength="<?php echo $maxName; ?>" value="<?php echo stripslashes($name); ?>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" maxlength="<?php echo $maxEmail; ?>" value="<?php echo stripslashes($email); ?>" /></td>
</tr>
<tr>
<td>Bericht:</td>
<td><textarea name="message" rows="4" cols=""><?php echo stripslashes($message); ?></textarea></td>
</tr>
<tr>
<td><img src="captcha/captcha.php" alt="Are You Human?" /></td>
<td><input type="text" class="captcha" name="captcha" maxlength="4" />
<span class="note">(verifiëer uw code)</span></td>
</tr>
<tr>
<td><input type="reset" value="Reset Form" class="buttons" /></td>
<td><input type="submit" value="Save Message" class="buttons" /></td>
</tr>
</table>
</form>
</div>
<?php
}
}
// WHEN ACTION IS "View Comment(s)"
elseif($act == "viewComments") {
$sql = "SELECT `name`, `email`, `showEmail`, `enableEmoticons`, `message`, `time` FROM guestbook ORDER BY `id` DESC";
$dataQuery = mysql_query($sql);
echo "<h3>De Berichten:(" . mysql_num_rows($dataQuery) . ")</h3>\n";
if(mysql_num_rows($dataQuery) == 0) {
echo "<p>Op dit moment zijn er geen berichten. <a href=\"?action=addComment\">Ben jij de eerste die er een maakt?</a></p>\n";
}
else {
while($data = mysql_fetch_assoc($dataQuery)) {
?>
<div class="gbEntry">
<div class="gbDetails stijl2">
<?php if($data['showEmail'] == 1) { ?><a href="mailto:<?php echo $data['email']; ?>"><?php } echo stripslashes($data['name']); if($data['showEmail'] == 1) { ?></a><?php } ?>
<span class="stijl1">Geschreven op:</span>
<?php $date = new DateTime($data['time']); echo $date->format('d/m/Y, H:i:s'); ?>
</div>
<div class="gbContent">
<?php
$message = ubb(nl2br(stripslashes(htmlentities(valid($data['message'])))));
if($data['enableEmoticons'] == 1) {
echo emoticons($message);
}
if($data['enableEmoticons'] == 0) {
echo $message;
}
?>
</div>
</div>
<?php
}
}
}
else {
echo "<h4>Het Kitestyle Gastenboek</h4>\n";
?>
<br>
<a href="?action=addComment">Plaats Bericht</a>
<ul>
WRONG PAGE
</ul>
<?php
}
?>
</td>
<td rowspan="2">
<img src="afbeeldingen/Index_11.jpg" width="184" height="647" alt=""></td>
</tr>
<tr>
<td colspan="5">
<img src="afbeeldingen/Index_12.jpg" width="597" height="38" alt=""></td>
</tr>
<tr>
<td>
<img src="afbeeldingen/spacer.gif" width="301" height="1" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="111" height="1" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="217" height="1" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="39" height="1" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="211" height="1" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="19" height="1" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="184" height="1" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
En hier de link met het script: http://www.kitemag.nl/Kitestyle2009/guestbook.php?action=viewComments