Jump to content

html/hack prevention search bar


MDanz

Recommended Posts

 <input type="text" size="35" name="search" id="search" style="text-align: center"/>

 

i have the above in a form. is the below code enough to prevent stuff like spam-bombs etc

 

$search = mysql_real_escape_string($_POST['search']);

 

 

if any better suggestions please let me know.

 

 

Link to comment
https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/
Share on other sites

i have a time limit between each post.

How are you storing and checking if a post is within a certain amount of time from the previous post?

 

Edit: and if this is a search form, how are you identifying which visitor each post comes from?

i checked phpmyadmin.. and it seemed a spambomb which generated 1000 replies , causes 1000 rows.  what would you recommend to prevent this?  i have a time limit between each post.

 

Like Thorpe said, you need to validate all incoming data.  Running data through an escape (like mysql_real_escape_string) should be the last step before database insertion.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.