$author = trim($_POST['author']);
$email = trim($_POST['email']);
$site = trim($_POST['site']);
preg_match("#http://[(www.|)a-z0-9(-|_|)a-z0-9]*.[a-z]*#i", $site, $sit);
$message = str_replace("\n", "
", ltrim(rtrim($_POST['message'])));
/* this "include" item relates to where the db config page is, no need to change it if you haven't moved it */
include('config.php');
$message = str_replace("\n", "
", ltrim(rtrim($_POST['message'])));
if($_POST['submit']) {
$back = "Back";
if($author == 'Name' || $author == 'user' || $author == 'spam' || !$author){
die("Error! : No name entered.
$back");
}
if(($site) && (!$sit)){
die("Error! : Enter a valid website with 'http://' or no site at all.
$back");
}
if($message == 'Message' || !$message){
die("Error! : No message entered
$back");
}
/* strip html tag's, allow only
and tags
if you wish to add more tags simple add the tag right after (make sure to use a space after )
you can do it to more then just the message also */
$message = strip_tags($message, '
');
$email = strip_tags($email);
$author = strip_tags($author);
/* check message length change "200" to change the limit (includeing spaces) */
$message_length = strlen(stripslashes($message));
if($message_length > 200){
die("Messages must be shorter then 200 characters. Your message is: $message_length characters");
}
/* this the smilie tag area for each new one you want to add follow the example show below you then must also edit index.htm
"THING_USER_TYPES_IN" => " IMG_LOCATION ",
"ANOTHER_THING" => " ANOTHER_IMAGE "
commas between the smilies, spaces in the quotes with the so they are bunched up or right ontop of text. */
$smiles = array(":)" => "
",
":(" => "
",
":D" => "
");
$message = strtr($message, $smiles);
/* this inserts everything into the database then closes the connect to prevent hacking. */
mysql_query("INSERT INTO shoutbox (message, author, email, date, ip)
VALUES ('$message','$author','$email','$date','$_SERVER[REMOTE_ADDR]')");
mysql_close();
/* thank you page, redirects 5 seconds after the page is loaded. Change the tag's "content=5" to the number of seconds you want */
echo "Your chat entry has been submitted, the top window will display your new entry shortly
Return Home";
}else{
echo "