Ok i made this script so i could easy update my usless infomtion archive.
Plus as a few people have been asking for a similar i posted it here.
Its highly customible. and runs of flat files, so all you need is php support o your host. it's pretty simple, athogh now has some advanced funcinality
fetures
Amount to show per page.
ordering, show newsits at top or bottom
Word filter
Ip Banning
multiple config options
The whole script needs 3 pages.
send.php (you can reaname if you wnat)
useinfo.php
data.txt
Send.php
HTML Code:<?php // Config $Lines = file("data.txt"); //file to get data form $max = 10; //Enteries to show $what = "Guest Book"; // what is it, guest book, dj request etc? $mail = "[email protected]"; // Admin eamil sort($Lines); // remove if you wnat the newist one shown at bottom $t = 100 - sizeof($Lines) ; //set to 999 to be able to hold more entries. // Banned Ip list $banned_ip = array(); $banned_ip[] = '00.00.000.001'; //To Ban an ip simply ad another one of these but with the ip you wish to ban //$banned_ip[] = '00.00.000.002'; // for exsample. just without the comments foreach($banned_ip as $banned) { $ip = $_SERVER['REMOTE_ADDR']; if($ip == $banned){ echo "<b>You Have Been Baned From Useing this "; echo $what ; echo ". if you think this was an accidnt eamil me at "; echo $mail ; echo "</b>"; } } if ( $ip !==$banned) { // start form Echo '<form name="form" method="post" action="useinfo.php"> Name : <input type="text" name="name"> <br> Email : <input type="text" name="email"> <br> Message : <input type="text" name="message"> <input type="hidden" name="num" value="';echo($t);echo'"> <br> <input type="submit" name="Submit" value="Submit"> </p>'; // end form echo '<br><b>'; echo 'The last '; echo ($max ); echo ' Enteries are shown in this'; echo $what ; echo' <br>'; echo '</b> '; foreach($Lines as $Key => $Val) { //explode that data into a array $Data[$Key] = explode("||", $Val); } // how data is displayed for($K = 0; $K<$max + 1; $K++) { echo '<p>'; echo '<br><b>'; echo ( $Data[$K][1] ); echo '<br>'; echo ( $Data[$K][2] ); echo '<br>'; echo ( $Data[$K][3] ); echo '</b>'; echo '</p>'; } echo "email the admin at "; echo $mail; echo " for help"; } ?>
Then the bit that gets the form info and writes it to the flat file
useinfo.php
then you just need a database, or data.txt, chmod it to 777 (aka make it read and writebale etc)HTML Code:<?php if ($_SERVER['REQUEST_METHOD'] != 'GET'){ $name = $_POST['name']; //get name $email = $_POST['email']; // get email $message = $_POST['message']; // get message $num = $_POST['num']; // number to oreder entrie by $bad_words = explode('|', '****|****|****|****|***|*****|******|*****'); //bad words foreach ($bad_words as $naughty) { $name = eregi_replace($naughty, "CENCORED", $name); $email = eregi_replace($naughty, "CENCORED", $email); $message = eregi_replace($naughty, "CENCORED", $message); } $file = "data.txt"; // file to get data form $fp = fopen($file, "a") or die("not work"); fputs($fp, " $num || Name : $name || Email : $email || Mesage : $message \n"); //write data to file fclose($fp); Header("Location: send.php"); // loction to send back to when done } else { echo 'ERROR'; } ?>
Or if you wnat it as a submition form.
teh request from is
And to just diplay the data on the pageHTML Code:<?php $Lines = file("data.txt"); //file to get data form $t = 99 - sizeof($Lines) ; //set to 999 to be able to hold more entries. // start form Echo '<form name="form" method="post" action="useinfo.php"> Name : <input type="text" name="name"> <br> Email : <input type="text" name="email"> <br> Message : <input type="text" name="message"> <input type="hidden" name="num" value="';echo($t);echo'"> <br> <input type="submit" name="Submit" value="Submit"> </p>'; // end form ?>
I hope this helps someone.HTML Code:<? $Lines = file("data.txt"); //file to get data form $max = 20; //Enteries to show sort($Lines); echo '<br><b>'; echo 'The last '; echo ($max ); echo ' Enteries are shown on this page <br>'; echo '</b> '; foreach($Lines as $Key => $Val) { //explode that data into a array $Data[$Key] = explode("||", $Val); } // how data is displayed for($K = 0; $K<$max; $K++) { echo '<p>'; echo '<br><b>'; echo ( $Data[$K][1] ); echo '<br>'; echo ( $Data[$K][2] ); echo '<br>'; echo ( $Data[$K][3] ); echo '</b>'; echo '</p>'; } ?>
And this is my first script and is VERY basic, athogh im currtaly working on adding a few extra fetures
remember if yopu wnat to just use the submit forum, make shore teh header laoction in the useinfo.php is the file teh form is on.
You can see my super simple script in actaion at
whole thing
http://thybag.co.uk/test/send.php
Just the send
http://thybag.co.uk/test/rec.php
or just the display
http://thybag.co.uk/test/show.php
Athogh in the eg, the rec.php page jumps back to the main send.php as teh header info in the useinfo.php hanst been updated
The code os also pretty versitle. and can be used for amny differnt things for exsample this note box
http://thybag.co.uk/test/notebox.php
Update: useinfo.php code eupdated so if viewed in browser errors insted of making blank submition
Update: useinfo.php code updated. Now has word filter . ( forum filltered out the filter list for the codes filter, so you will have to re filling the started values)
Update: send.php code updated. Now fetures Ip banning
Update: send.php code updated. Impoved Ip banning, More user configarble elimnets. Better code hints
Im currtly working on an admin script








Reply With Quote
al PM you if i need help.

