{"id":187530,"date":"2005-04-14T22:02:42","date_gmt":"2005-04-14T22:02:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/a-simple-php-comment-spam-hack\/"},"modified":"2016-08-18T19:44:59","modified_gmt":"2016-08-18T19:44:59","slug":"a-simple-php-comment-spam-hack","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/a-simple-php-comment-spam-hack\/","title":{"rendered":"a simple php comment spam hack"},"content":{"rendered":"<p>hey all:<\/p>\n<p>its what i call, um &#8220;dynamically manual&#8221; ; )<\/p>\n<p>on my index page (http:\/\/www.latinosfortexas.com)  i have a script to show the last 8 posts, and last 8 comments from the blog.<\/p>\n<p>of course in the last 24 hours &#8220;poker&#8221; seems to have been reaaaaal popular. so i simply added an include on my index page:<\/p>\n<p><code>include(&quot;spamdeleteauto.php&quot;);<\/code><\/p>\n<p>which points to a pretty straightforward php page to simply delete comments which include the word &#8220;poker&#8221;.<\/p>\n<p><code><br \/>\n&lt;?php&lt;br \/&gt;<br \/>\ninclude(&quot;dbaseinfo.inc.php&quot;);<br \/>\nmysql_connect($hostname,$username,$password);<br \/>\n@mysql_select_db($database) or die( &quot;Unable to select database&quot;);<br \/>\n\t$query = &quot;DELETE FROM <\/code>wp_comments<code> WHERE <\/code>comment_content<code> LIKE &#039;%poker%&#039;&quot;;<br \/>\n\t$result=mysql_query($query);<br \/>\nmysql_close()<br \/>\n?&gt;<br \/>\n<\/code><\/p>\n<p>i know, a little brute force but works well. i think i ll make a table of spamwords and loop thru them, but for now, tho its not stopped the poker spam, it HAS stopped it from being seen by deleting it.<\/p>\n<p>just sharing,<br \/>\nm<\/p>\n","protected":false},"template":"","class_list":["post-187530","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/187530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/187530\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=187530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}