Tips to protect your site from Hackers and Spammers

Discussion in 'PHP' started by clinton, Nov 16, 2007.

  1. #1
    I want everyone to post 1-2 tips for making it harder for hackers and spammers to get into your site.

    Here are mine:)

    1. Guard each and every <input> on the site, even select, radio, checkbox and hidden.
    2. Use PHP to sanitize all your post and get variables.
    3. Make sure your urls are protected from certain characters eg $()\/"':;><
    4. Make sure that forms which display form data are protected
    eg. <input type="text" name="name" value="<?=$_POST["name"]?>" />
    Be sure to sanitze that variable before someone does something crappy and it parses like this:
    <input type="text" name="name" value="fuck"><br /><br /><b></b>" />

    5.Test your scripts and php over and over, try hacking your site, if you have any trusted friends that know how to hack then get them to test it out also. Make sure everything matches up so the code doesn't break.


    any more tips???? Please post
     
    clinton, Nov 16, 2007 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    Email forms are most dangerous

    Or what you call feedback forms

    Hackers exploit this to send spam from your site

    Solution : Validate the To: part it should have only one "@",Attach a antispam note at bootom of email when someone fill the form With a link to report spam


    Regards

    Alex
     
    kmap, Nov 16, 2007 IP
  3. mindphp

    mindphp Well-Known Member

    Messages:
    88
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #3
    use framework validate
     
    mindphp, Nov 16, 2007 IP