Free web development scripts for the webmasterDevelopment Scripts


 social media marketing services
 Site Navigation
Clicky Web Analytics
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 1 user online
 o Most users online: 67
 o Home
  o PHP
   o Online Communities
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Paper Free Invoicing
 o Tutorials
 o Expired Domain Crawler

Ultra secure shoutbox lite (Rated 4.4)

Description:

OK written this tiny shoutbox (under 30 lines of code).

Features:
- :) to Image converter
- Swear filter
- Ultra Secure
- Flood Control
- IP Banning
- CSS for customisation

All in under 30 lines of code including the form and CSS styles!!

This was a little test to see who could produce the smallest most secure shout box ever.
This is my effort and I'm pretty pleased with it!

Check it out here (http://www.rendells.net/shout/shout.php)

Code starts here


-- SQL to create shoutbox table
CREATE TABLE `shout` (
`message` text NOT NULL,
`time` int(11) NOT NULL,
`ip` text NOT NULL,
`name` text NOT NULL,
`banned` tinyint(4) NOT NULL default '0'
) TYPE=MyISAM;

-- shout.php
<style type="text/css">
body,textarea,input,h2 {font-size: 8pt; font-family: arial;}
h1 {font-size: 10pt; font-family: arial; color: #FFFFFF; background-color: #4C5D8D;}
</style>
<?PHP
$connection
= mysql_connect('dbhost','dbusername','dbpasswd') or die(mysql_error());
mysql_select_db('database_name', $connection) or die(mysql_error());
function
filter($text) {
$replace=array(':)'=>' <img src="smile.gif">',':('=>' <img src="sad.gif">',':D'=>' <img src="biggrin.gif">',':p'=>' <img src="tongue.gif">',';)'=>' <img src="wink.gif">','\''=>'',';'=>'','--'=>'');
foreach(
$replace as $old=>$new) $text = str_replace($old,$new,$text);
return
$text ;
}
if(isset(
$_POST['submit'])) {
$result = mysql_query("select max(`time`), max(`banned`) from `shout` where `ip` = '".$_SERVER['REMOTE_ADDR']."'");
$result = mysql_fetch_array($result);
$name = filter(wordwrap(htmlentities($_POST['name']),25,'<br />',1));
$message = filter( substr( wordwrap( nl2br( htmlentities($_POST['message'])),32,'<br />',1),0,250));
if (((
time() - $result[0]) > 30) && ($result[1]!=1))
mysql_query("insert into shout(`name`,`time`,`message`,`ip`) values('$name','".time()."','$message','".$_SERVER['REMOTE_ADDR']."')");
else echo
"<div style=\"background-color:#99CCFF;\"><h2>Slow down!</h2 ></div>";
}
$resultSet = mysql_query("select `name`, `time`, `message` from `shout` order by `time` desc limit 5");
while (
$record = mysql_fetch_assoc($resultSet))
echo
"<div><h1>".$record['name']." - ".date("H:i",$record['time'])."</h1>\n".$record['message']."</div>" ;
?>
<form action="shout.php" method="post" name="shout">
<input name="name" type="text" value="" size="23" maxlength="20"><br />
<textarea name="message" cols="20" rows="5" maxlength="100"></textarea><br />
<input name="submit" type="submit" value="submit">
</form>


Submitted by Devscripts on 05-09-2003 17:16


Recent Additions (from all categories)

(PHP) T Shirt Printing Software

(PHP) Youtube Video Organizer Script

(PHP) MP3z - MP3 Search Engine Script

(PHP) Recipez- PHP Recipe Script

(ASP) Stop image hotlinking and downloading. Web image protection is easy with Image Trapper.

Top Rated Scripts

(Javascripts) Javascript Delayed Redirection Rating: 5

(PHP) Random Links and images with PHP & MySQL Rating: 5

(PHP) RSS/XML news feed headline grabber! Rating: 5

(PHP) Random Signatures/Avatars Rating: 5

(Javascripts) Detecting Client Web Browser Rating: 5

© Copyright 2003 - Devscripts.net  Web Analytics