gcphost Posted February 25, 2011 Share Posted February 25, 2011 I offer a free trial product and it tends to get those bogus 'asdf' users - im sure there is some other way to do this but the way I wanted to is simply writing my own hook. This lets me define individual flags to match against, and how, im general - if it matches any of the 'bs' then out it goes. <?php function bad_var($val){ $bad=array(); $bad[]="asdf"; $bad[]="opk"; $bad[]="12345"; $bad[]="dfgh"; $bad[]="test"; foreach($bad as $b=>$d){ if(preg_match("/$d/s", $val)) return true; } return false; } function BogusUser($vars) { global $errormessage; foreach($vars as $v => $r){ if(bad_var($r)) $errormessage.="The field $v has an value that did not pass validation. Please change it and try again!<br>"; } } add_hook("ClientDetailsValidation",1,"BogusUser"); ?> Did lite testing, seems to work well - almost hard to go wrong but certainly if I did post back. 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted February 25, 2011 Share Posted February 25, 2011 Awesome! Just what I was about to develop. Saved me some development time, I am going to try this out Hopefully it will reduce fraud 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted February 25, 2011 Author Share Posted February 25, 2011 I hope it will If anyone who uses it updates this thread with their array we can all share a good source of "bogus data". 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted February 25, 2011 Author Share Posted February 25, 2011 I would also note this should probably have a case for the error and a case for the var checking to match the user input variables and to output the error in the correct language. I didnt care - clearly - but if someone were to update it thatd be sweet 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted February 27, 2011 Author Share Posted February 27, 2011 Just to update that the last 2 days have been great! Those "asdf" users are totally gone, people now provide real and valid information almost all the time! I've added more filters - like a direct (not preg match) filter array to help with "lol lol" names, I am sure others get those too. Using this with with some new order system changes and my custom programs to help sell licenses WHMCS is finally working out well for me, the hooks have paid off big time for me. <?php function bad_var($val){ $baddirect=array(); $baddirect[]="lol"; $baddirect[]="lol "; $baddirect[]="lol lol"; $bad=array(); $bad[]="asdf"; $bad[]="opk"; $bad[]="12345"; $bad[]="dfgh"; $bad[]="test"; $bad[]="dsds"; $bad[]="afvbs"; $bad[]="aaa"; $bad[]="bbb"; $bad[]="aewqr"; $bad[]="acxzcz"; $bad[]="aasdsda"; $bad[]="sdaasd"; $bad[]="acxzcz"; $bad[]="asdasd"; $bad[]=" lol "; foreach($bad as $b=>$d){ if(preg_match("/$d/s", $val) || $d == $val) return true; } foreach($baddirect as $b=>$d){ if($d == $val) return true; } return false; } function BogusUser($vars) { global $errormessage; foreach($vars as $v => $r){ if(bad_var($r)) $errormessage.="The field $v has an value that did not pass validation. Please change it and try again!<br>"; } } add_hook("ClientDetailsValidation",1,"BogusUser"); ?> 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted March 2, 2011 Author Share Posted March 2, 2011 Oh my 3 more days people and how many bogus users? NONE - yea - if youre getting em - USE THIS - even its basic array does a good enough job for my site. I used to get a couple every day! 0 Quote Link to comment Share on other sites More sharing options...
Manchester Web Hosting Posted July 17, 2011 Share Posted July 17, 2011 Good basic mod! not getting those weird orders any-more 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted August 16, 2011 Share Posted August 16, 2011 Just wanted to share my improvements on this script, adding a role based email address filter, and also filtering the input more to account for changes in case and spacing, this hook now filters bad names like aSDF and aDMin@domain.com (role based address) <?php function bad_var($val){ $baddirect=array(); $baddirect[]="lol"; $baddirect[]="lol "; $baddirect[]="lol lol"; $bad=array(); $bad[]="asdf"; $bad[]="opk"; $bad[]="qwerty"; $bad[]="12345"; $bad[]="dfgh"; $bad[]="test"; $bad[]="dsds"; $bad[]="dsf"; $bad[]="afvbs"; $bad[]="aaa"; $bad[]="bbb"; $bad[]="aewqr"; $bad[]="acxzcz"; $bad[]="aasdsda"; $bad[]="sdaasd"; $bad[]="acxzcz"; $bad[]="asdasd"; $bad[]="nostreet"; $bad[]="1234as"; $bad[]="root@"; $bad[]="admin@"; $bad[]="default@"; $bad[]="administrator@"; $bad[]="info@"; $bad[]="webmaster@"; $bad[]="sales@"; $bad[]="support@"; $bad[]="management@"; $bad[]=" lol "; foreach($bad as $b=>$d){ if(preg_match("/$d/s", $val) || $d == $val) return true; } foreach($baddirect as $b=>$d){ if($d == $val) return true; } return false; } function BogusUser($vars) { global $errormessage; foreach($vars as $v => $r){ if(bad_var(trim(strtolower($r)))) { if ($v == "email") $errormessage.="<li>Please use a personal email address, not a generic/root address.</li>"; else $errormessage.="<li>The field $v has an invalid value. Please enter your correct information!</li>"; } } } add_hook("ClientDetailsValidation",1,"BogusUser"); ?> 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted August 16, 2011 Share Posted August 16, 2011 Here is an updated array of role based addresses that mailchimp doesn't allow (see http://kb.mailchimp.com/article/what-role-addresses-does-mailchimp-specifically-block-from-bulk-importing/) : $roles = array('info@', 'help@', 'admin@', 'biz@', 'bizdev@', 'support@', 'faq@', 'customerservice@', 'press@', 'sales@', 'webmaster@', 'abuse@', 'postmaster@', 'editor@', 'hostmaster@', 'investorrelations@', 'jobs@', 'marketing@', 'media@', 'noc@', 'remove@', 'request@', 'root@', 'security@', 'spam@', 'subscribe@', 'usenet@', 'users@', 'uucp@', 'www@', 'news@', 'enquiries@', 'service@', 'advertising@', 'marketing@', 'finance@', 'accounting@', 'billing@', 'legal@', 'jobs@', 'hr@', 'service@', 'investors@', 'board@', 'ventas@'); Then in the check function, add in this foreach loop: foreach($roles as $b=>$d){ if(preg_match("/$d/s", $val) || $d == $val) return true; } 0 Quote Link to comment Share on other sites More sharing options...
Brainchild Labs Pty Ltd Posted November 5, 2011 Share Posted November 5, 2011 Can someone let the rest of us know what file needs to be modded for this mod to work ? Cheers. 0 Quote Link to comment Share on other sites More sharing options...
Alain Posted November 6, 2011 Share Posted November 6, 2011 Hi, Can someone let the rest of us know what file needs to be modded for this mod to work ? Cheers. This is an action hook. So, you must create a new php file (name it as you want), insert the code inside this file and the upload it to your hooks directory (/your_installation_path/includes/hooks/). 0 Quote Link to comment Share on other sites More sharing options...
Brainchild Labs Pty Ltd Posted November 7, 2011 Share Posted November 7, 2011 Great thats for the clarification. 0 Quote Link to comment Share on other sites More sharing options...
zomex Posted November 7, 2011 Share Posted November 7, 2011 Very nice mod, thanks for sharing! 0 Quote Link to comment 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.