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!


Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default Need Help [Differant]

    Right i have this code so far;

    PHP Code:
    <?php

    // This gets the information from the form
    $name $_POST['name'];
    $website $_POST['website'];
    $message $_POST['message'];

    // This takes the smiley code in the message and turns it into a smiley
    $code = array(
        
    '/:\)/',
        
    '/:P/',
        
    '/:D/'
    );

    $image = array(
        
    '<img src="smileys/smile.gif">',
        
    '<img src="smileys/razz.gif">',
        
    '<img src="smileys/biggrin.gif">'
    );
    $formatted preg_replace($code$image$message);

    if(empty(
    $name) OR empty($message))
    {
    echo 
    "Please fill it out the name,website or message field.";
    }
    else
    {
    // Set up how it's going to be displayed.
    $tag = ("<font size=\"1\" face=\"Verdana\">
    <b>
    $name</b>: $message </font><br><br>"); 

    // Gather the data currently in the file
    $read fopen("content.txt""r");
    $contents fread($readfilesize('content.txt'));
    fclose($read);

    // Open the file and write the tag to it
    $write fopen("content.txt""w");
    fwrite($write"$tag $contents");
    fclose($write);
    }

    // Refresh!
    print "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";

    ?>
    I need someone to insert a code so HTML is disable so people cannot type in HTML

  2. #2
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    id change your meta redirect to a header redirect, that way it causes no back button issues and is cleaner.

    Easyest way to filter html is the lazymans way, aka use on of phps built in functions

    htmlspecialchars()

    so

    $message = htmlspecialchars($message);

    is the kinda of thing u want

  3. #3
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    Thanks will try.

    Edit: OK Doesn't work, or can someone put entors script into my code, thanks.
    Last edited by Drugs; 09-08-2006 at 09:23 AM.

  4. #4
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Try

    PHP Code:
    <?php

    // This gets the information from the form
    $name $_POST['name'];
    $website $_POST['website'];
    $message $_POST['message'];

    // This takes the smiley code in the message and turns it into a smiley
    $code = array(
        
    '/:\)/',
        
    '/:P/',
        
    '/:D/'
    );

    $image = array(
        
    '<img src="smileys/smile.gif">',
        
    '<img src="smileys/razz.gif">',
        
    '<img src="smileys/biggrin.gif">'
    );
    $formatted preg_replace($code$image$message);

    if(empty(
    $name) OR empty($message))
    {
    echo 
    "Please fill it out the name,website or message field.";
    }
    else
    {
    // Set up how it's going to be displayed.
    $message htmlspecialchars($message);
    $tag = ("<font size=\"1\" face=\"Verdana\">
    <b>
    $name</b>: $message </font><br><br>"); 

    // Gather the data currently in the file
    $read fopen("content.txt""r");
    $contents fread($readfilesize('content.txt'));
    fclose($read);

    // Open the file and write the tag to it
    $write fopen("content.txt""w");
    fwrite($write"$tag $contents");
    fclose($write);
    }
    // Refresh!
    print "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";

    ?>
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  5. #5
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    YESSSSSSSSSS!!!!!
    YESSSSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!

    IT WORKS!!!!!!!!!!!!!! YEEEEEEEEEEEEEEEEEEEEEEEES!!!!!!!!!!!!!!!!!!!!!!!! !!

    WOOOOOOOOOOOOOOOOHOOOOOOOOOO *KISSES FUJITSU* WOOOOOOOHOOOOOOOOOOOOOOOOOOOOOO

  6. #6
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Lol I just tested it on your shoutbox and yep it works. Thanks to Mentor for the code and me for putting it in :p
    Last edited by Fujitsu; 09-08-2006 at 09:48 AM.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  7. #7
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    Yeah! Go say something now look what i made happen when a message is entered.. And when you leave a field blank..

  8. #8
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Why, when I send a message with a blank or not blank fields, when I press submit it refreshes the alert like loads of times. I have to keep hold of enter and click google toolbar to get off it!
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  9. #9
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    o.0 *Makes Longer* Dunno but ah well.

  10. #10
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    And it says. Thanks for your message Fujitsu, then alerts please enter name and message loads of times.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

Page 1 of 2 12 LastLast

Posting Permissions

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