It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

avoid php hackers from forms

Moderator: Malcolm

avoid php hackers from forms

Postby john_zakaria on Wed Sep 29, 2010 11:14 am

please i want to know how to avoid hacker from hacking my website using forms

i wrote only in the post:

Code: Select all
htmlspecialchars($_POST['first_name']);


notice that i made validation using javascript to my form..
but hackers can make sql statment to delete my DB or any type of hacking..


but my question is : can the code htmlspecialchars avoid hacking from forms?? or how to avoid it??




how to stop hackers or avoid them from hacking my website??
john_zakaria
50+ Club
 
Posts: 60
Joined: Sun Feb 08, 2009 7:29 am

Re: avoid php hackers from forms

Postby webmaster on Wed Sep 29, 2010 11:54 am

Does your form connect to a database, is it a mail form or what kind of script is behind it?
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Re: avoid php hackers from forms

Postby HotNoob on Wed Sep 29, 2010 2:50 pm

The html special characters converts all of the <, > and so on... characters in to stuff like &gt; and &lt; so that they are not processed as html in a browser.

However, the main thing you should be concerned with is mysql query injections, depending on your php's configuration, you might not have a problem with it, but if you do, you will need to use functions like mysql_real_escape_string() to clean the string.

---
However, the best way to stop hackers is simply to add a captcha, because now adays most hacks are done via crawl bots that try to hack various websites using what i like to call, "Voob" hacking methods.

Since most bots can't get past basic captcha, you should be fine; and i seriously doubt you will get even remotely enough traffic to attract a hacker to your website. As long as you don't use any content managers than you should be fine.
Stuff like joomla is relatively easy to hack into, although PHPBB3 for the most part is pretty difficult to get into.
HotNoob
100+ Club
 
Posts: 169
Joined: Sun May 02, 2010 1:38 am


Who is online

Users browsing this forum: No registered users and 1 guest