Make Urtutorials.com your homepage | Add to Favorites      


Shoutbox  

Shoutbox!
This tutorial will show your how to create your very own shout box

Code:

A simple yet powerful shout tag. As this shout tag use no database ( MySQL ) so it has no archive and admin control, but it has word sensor.

First, create a flat file that store your shout message. Let's just called it as shout.txt. We goes with the setting:

$dataf = "shout.txt";         // Which the shout save
$length = 100;                
// How long the message can be
$comments = 12;            
// How many message to appear

Some visitor like to be anonymous, so they will not write their name on it. So you have to give them a name:
if (!$name)
{ $name = "Anonymous"; }
else $name .= ":";

Now the most important part. As there is no admin control, you will definitely  need word sensor. Replace any flirting language you know!
$message = str_replace("fuck","****",$message);
$message = str_replace("bitch","****",$message);
$message = str_replace("asshole","****",$message);
$message = str_replace("cunt","****",$message);
$message = str_replace("bullshit","****",$message);
$message = str_replace("shit","****",$message);
$message = stripslashes($message);
$comfile = file($dataf);

And now, the last part of the setting. This will be generated in shout.txt you created the the begining.

if ($message != "") {$df = fopen ($dataf, "w");
$message = stripslashes($message);fwrite ($df, "email>@ url target='_blank'>$name: $message\n
");
for ($i = 0; $i < $comments; $i++) {fwrite ($df, $comfile[$i]);}fclose($df);}
Header("Location: $HTTP_REFERER");
?>

After all the setting, save the file as setting.php. And then we goes to the final part which is the form.


Name:
name
" > // The form's name must be the same as in the setting ( highlighted above ).
Message:
message
" >
Url:
url
" value="http://www." >
Email:
email
" >


Save this file as whatever you want, BUT with .php extention. And then upload these 3 files ( shout.txt, setting.php, this file ) under one same roof. And you're ready to go. *You need to CHMOD 777 shout.txt.
 
Discuss this tutorial in the Forum.

Other good stuff:-


Submited by:- Farooq Azam

Discussions Forum Login:-

Username:
Password:  

Remember Me    
Not a member?
Register here

Copyright © UrTutorials.com - All rights ® reserved A Publispain Group Website