MDanz Posted March 17, 2010 Share Posted March 17, 2010 <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. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/ Share on other sites More sharing options...
trq Posted March 17, 2010 Share Posted March 17, 2010 mysql_real_escape_string does NOTHING to prevent spam. It strips strings of harm full data that may cause sql injections. You need to validate your data contains what you want. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027517 Share on other sites More sharing options...
MDanz Posted March 17, 2010 Author Share Posted March 17, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027522 Share on other sites More sharing options...
PFMaBiSmAd Posted March 17, 2010 Share Posted March 17, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027523 Share on other sites More sharing options...
KevinM1 Posted March 17, 2010 Share Posted March 17, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027525 Share on other sites More sharing options...
trq Posted March 17, 2010 Share Posted March 17, 2010 Depending on how serious you are, I would take a look at akismet. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027526 Share on other sites More sharing options...
MDanz Posted March 17, 2010 Author Share Posted March 17, 2010 i just used the search as an example. the spam happens on my reply to post form. what steps would i use to validate the post then? when making new threads i use captcha.. but for forum users you don't want to use captcha every time you post. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027528 Share on other sites More sharing options...
trq Posted March 17, 2010 Share Posted March 17, 2010 Your not likely to prevent spam through simple filter, you'll get some, but not for long. That's what mods are for. You think this site has spam protection? No, we have admins/mods/gurus & recommended users keeping the place running. Quote Link to comment https://forums.phpfreaks.com/topic/195548-htmlhack-prevention-search-bar/#findComment-1027531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.