Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
avoid php hackers from forms
Old 09-29-2010, 07:12 AM avoid php hackers from forms
Skilled Talker

Posts: 97
Trades: 0
please i want to know how to avoid hacker from hacking my website using forms

i wrote only in the post:

PHP Code:
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 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-29-2010, 07:19 AM Re: avoid php hackers from forms
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
To avoid SQL injection, use:
PHP Code:
$me mysql_real_escape_string($_POST['first_name']); 


To avoid HTML injection as well, try this:

PHP Code:
$me mysql_real_escape_string($_POST['first_name']);
$me strip_tags($me); 

__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 09-29-2010, 03:16 PM Re: avoid php hackers from forms
Novice Talker

Posts: 5
Name: yessss
Trades: 0
yes we can tnx
swarz is offline
Reply With Quote
View Public Profile
 
Old 09-29-2010, 03:17 PM Re: avoid php hackers from forms
Novice Talker

Posts: 5
Name: yessss
Trades: 0
but does it work?
swarz is offline
Reply With Quote
View Public Profile
 
Old 09-29-2010, 03:34 PM Re: avoid php hackers from forms
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Quote:
Originally Posted by swarz View Post
but does it work?
Your 2 posts dont make sense?

As above:
$me = mysql_real_escape_string($_POST['first_name']);

Will work fine.

ANY! data you pass to a SQL database, run though the
mysql_real_escape_string
function and you wont need to worry about injections.


__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 09-30-2010, 12:50 PM Re: avoid php hackers from forms
Novice Talker

Posts: 5
Name: yessss
Trades: 0
yes ok thank you
swarz is offline
Reply With Quote
View Public Profile
 
Old 09-30-2010, 02:29 PM Re: avoid php hackers from forms
Justinwiz's Avatar
Skilled Talker

Posts: 58
Name: Justin
Location: /etc/httpd/logs/error_log
Trades: 0
Ah, I was only using htmlspecialchars(), thanks for this
Justinwiz is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to avoid php hackers from forms
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33140 seconds with 12 queries