Blame | Last modification | View Log | Download
<?$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", "<br>", 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", "<br />", ltrim(rtrim($_POST['message'])));if($_POST['submit']) {$back = "<a href=\"javascript: history.back(-2)\">Back</a>";if($author == 'Name' || $author == 'user' || $author == 'spam' || !$author){die("Error! : No name entered.<br>$back");}if(($site) && (!$sit)){die("Error! : Enter a valid website with 'http://' or no site at all.<br>$back");}if($message == 'Message' || !$message){die("Error! : No message entered<br>$back");}/* strip html tag's, allow only <br> and <a> tagsif you wish to add more tags simple add the tag right after <a> (make sure to use a space after <a>)you can do it to more then just the message also */$message = strip_tags($message, '<br> <a>');$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 <img> so they are bunched up or right ontop of text. */$smiles = array(":)" => " <img src=/images/smilies/icon_smilie.gif> ",":(" => " <img src=/images/smilies/icon_sad.gif> ",":D" => " <img src=/images/smilies/icon_biggrin.gif> ");$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 <meta> 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<BR><a href=shoutbox.php>Return Home</A><meta http-equiv=refresh content=5;URL=shoutbox.php>";}else{echo "<form method=POST name=shoutbox action=shoutbox.php><input name=author type=text value=Name maxlength=15><br><textarea name=message cols=18>Message</textarea><br><input type=submit name=submit value=Submit></form><a href=/>Return Home</a>";}#OPTIONAL, to save file size, delete the orange comments?>