Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default Simple Guest book, / Dj request etc script

    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

    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';
    }
     ?>
    then you just need a database, or data.txt, chmod it to 777 (aka make it read and writebale etc)

    Or if you wnat it as a submition form.

    teh request from is

    HTML 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
    ?>
    And to just diplay the data on the page


    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>';
    }
    
    
    
    
    ?>
    I hope this helps someone.

    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
    Last edited by Mentor; 22-02-2005 at 04:12 AM.

  2. #2
    Join Date
    Oct 2004
    Location
    Scotland
    Posts
    2,280
    Tokens
    1,075

    Latest Awards:

    Default

    thats a big help thanks al PM you if i need help.

    http://www.stupidian.com
    (contains mild swearing)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •