OK, this is how to make a shoutbox, flat-files version so there is no need for a MySQL DataBase.
Features
-Word Filtering
-Spam Ban
-Error Handling
-Website Display
-Tag Removal
-Smilies!
Requirements:
PHP 4.x
FTP access: ability to add folders, files, and set CHMOD properties
<a href=\'http://www.smartftp.com\' target=\'_blank\'>SmartFTP</a> or a FTP program
Creating The Script
Now first off open up one of your favourite editors (dreamweaver optimal) and remove all of the generated code.
Now copy and paste the following code into the editor:
Code:
<?
// Left out be default, shows site when URL not entered
// $blankurl = "#";
// Converts any <enter> to <br>
$username = stripslashes($username);
$message = stripslashes($message);
// this makes the PHP get your IP address and turn it into a variable
$ip = getenv("REMOTE_ADDR");
// this is an array being assigned as a variable
$assIP = array ();
// this makes it so if if someone spams, they will be banned
foreach( $assIP as $temp )
{
if ($ip == $temp) {
echo "Your ip has been banned stop spamming here...";
exit;
}
}
/* FILTER */
// Grabs all variables
global $message;
// The strings that replace words into asterisks
$message = str_replace("fuck","f**k",$message);
$message = str_replace("ass","a*s",$message);
$message = str_replace("bitch","b**h",$message);
$message = str_replace("nigger","n****r",$message);
$message = str_replace("nigga","n***a",$message);
$message = str_replace("fucker","f****r",$message);
$message = str_replace("chink","c***k",$message);
$message = str_replace("shit","s**t",$message);
// To find smilies and add the images
// $message = str_replace(":)","<img src=\"/images/smile.gif\" alt=\"Smile\">",$message);
// $message = str_replace(":D","<img src=\"/images/smile.gif\" alt=\"Grin\">",$message);
// $message = str_replace(":(","<img src=\"/images/sad.gif\" alt=\"Sad\">",$message);
// Checking if your name will be used, or your IP address
if ($username == "name") {
$username = "$ip";
$URL = "";
}
else {
$username = $username;
}
// Checking if you forgot to enter in a message
if ($message == "message") {
header("Location: error.php");
die();
}
else {
$message = $message;
}
// Checking to see if you want to be Anonymous
if ( empty($username)) {
$postname = "Anonymous";
}
else {
$postname = $username;
}
// Checking if somone has a URL and if not, dont have a link
if ( empty($URL)) {
$nameformat = "<b>$postname</b>";
}
elseif ($URL == "http://") {
$nameformat = "<b>$postname</b>";
}
else {
$nameformat = "<b><a href=\"$URL\" target=\"_blank\">$postname</a></b>";
}
// Showing that if proper data is entered, show success.
if ( empty($message)) {
header("Location: error.php");
die();
}
elseif ($message == "Enter Message") {
header("Location: error.php");
die();
}
else {
$msg = $message;
header("Location: success.php");
}
Simple enough huh? Now the last file to code :) its just a form that sends the data to shoutbox.php the only PHP in that file is an "include" think of it as a iframe, it displays a different page on that page.
Now save all of the files under the shoutbox folder on your desktop. Open up notepad and save a file called shoutbox.txt add this to the top, save, and exit out of notepad:
Close your editor, take a nap (that means relax, here comes the hard part)
Upload The Files
Now open up your FTP Uploader program (SmartFTP is demonstrated)
<img src=\'http://img50.exs.cx/img50/6798/sbtut014aj.jpg\' border=\'0\' alt=\'user posted image\' />
Now once you have the information entered press your Enter key and wait for login
<img src=\'http://img50.exs.cx/img50/6518/sbtut026zx.jpg\' border=\'0\' alt=\'user posted image\' />
Hopefully you are in your root directory (the directory that is not inside another directory) and press Insert of your keyboard, this (in SmartFTP) creates a new folder/directory name it shoutbox.
<img src=\'http://img11.exs.cx/img11/1883/sbtut037sv.jpg\' border=\'0\' alt=\'user posted image\' />
Double click the shoutbox directory and it should open up the directory. From here open up the shoutbox folder on your computer and drag 'n' drop the files onto your shoutbox directory:
<img src=\'http://img11.exs.cx/img11/1778/sbtut044ve.jpg\' border=\'0\' alt=\'user posted image\' />
now select the shoutbox.txt and press F7 on your keyboard, this will open up the CHMOD commands. Set it to 777 (read, write, execute, for all)
<img src=\'http://img205.exs.cx/img205/6544/sbtut052qh.jpg\' border=\'0\' alt=\'user posted image\' />
Now create another folder inside /shoutbox called images, place the smilies you want in there (relative to names in shoutbox.php).
Close SmartFTP and open up your browser go to your website/shoutbox eg <a href=\'http://yoursite.com/shoutbox\' target=\'_blank\'>http://yoursite.com/shoutbox</a> and enjoy!
-----------------------
I hope I helped you all understand the process of taking data, handling it, and storing it without using a DataBase. If you have any questions, ask them here. I might update with a Admin CP script!
-----------------------
Online Demo: <a href=\'http://justin.pyro-studios.com/shoutbox\' target=\'_blank\'>http://justin.pyro-studios.com/shoutbox</a> feel free to post what you want! please no biogtry or profanity.
<span style=\'color:red\'> Do Not Abuse!
04-04-2005, 10:38 PM
Illegalx17
holy freaking crap dude thats awesome, great job. so damn complicated!!!!! i might go thru the whole thing sometime
04-04-2005, 10:41 PM
Forgotten
Thanks! I will post a detailed version going through all of the inner workings of the process, every string will be explained O.o
Also I will post a open source for ppl to custimize without taking the tutorial (hoping no one needs to skip the tutorial)
04-04-2005, 10:42 PM
Illegalx17
holy shit, a DETAILED ONE???? damn i got my reading for the next week cut out for me
04-04-2005, 10:51 PM
Forgotten
ROFL!
You think it's hard to read?? Try writing it! *drops dead*
04-04-2005, 11:18 PM
Illegalx17
lol i sympathize for ya man
04-04-2005, 11:33 PM
Forgotten
Please, if you come up with any new versions (such as smilies, word filters, etc.) post them here for all to see. And post the code to add to the existing tutorial :)
04-04-2005, 11:59 PM
Forgotten
Filter Installed, Big text fixed... uploading and writing tutorial later.
Tutorial edited to have new code installed.
04-05-2005, 01:54 PM
tacoX
I really like it! What I like most about it, is how it doesnt use MYSQL - which saves a hella lot of time.
Thanks mate =)
04-05-2005, 05:18 PM
Oblivion
WOW is that in depth, thanks a ton if i ever get a domain, ima use this tut for a shoutbox :)