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 9 of 9
  1. #1
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default Cleaning form inputs ??? [PHP]

    What procedures should I use when cleaning form inputs so they can't do injections and other crap like that?
    Chippiewill.


  2. #2
    Join Date
    Oct 2006
    Posts
    9,905
    Tokens
    26,858
    Habbo
    Zak

    Latest Awards:

    Default

    mysql_real_escape_string will protect against injection

    I usually use

    $example = mysql_real_escape_string(htmlentities(trim($_POST['example']))));

  3. #3
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    ^You've got an extra bracket.^

    PHP Code:
    function Sanitise($input){
    return 
    mysql_real_escape_string(strip_tags(html_entities(trim($input))));



    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  4. #4
    Join Date
    Oct 2006
    Posts
    9,905
    Tokens
    26,858
    Habbo
    Zak

    Latest Awards:

    Default

    Quote Originally Posted by triston220 View Post
    ^You've got an extra bracket.^
    Lmao yeh ****. Well spotted +rep

  5. #5
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    Quote Originally Posted by Zak View Post
    Lmao yeh ****. Well spotted +rep
    Hah, thanks.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  6. #6
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Do I need to use strip slashes at all?

    Edit: If I'm hashing a string do I need to bother cleaning it before hand?
    Last edited by Chippiewill; 20-12-2011 at 12:12 PM.
    Chippiewill.


  7. #7
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    To be honest, you don't really need to sanitise any input if you are hashing/encrypting it, unless the encryption/hash type uses special characters which would intefere with the query.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





  8. #8
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    I'm only using sha256 so I assume that's safe?
    Chippiewill.


  9. #9
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    846
    Tokens
    1,766
    Habbo
    triston220

    Latest Awards:

    Default

    Quote Originally Posted by Chippiewill View Post
    I'm only using sha256 so I assume that's safe?
    Pretty much, yes.


    Quote Originally Posted by Jaaaack! View Post
    See, however much I want this, my girlfriend uses my PC too much, and I would be killed.





Posting Permissions

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