discourse-legacysite-perl/site/forum.slowtwitch.com/www/admin/delete_spam_comments.php
2024-06-17 22:27:49 +10:00

48 lines
1.1 KiB
PHP

<?PHP
require_once ("config.php");
// GLINKS COMMENTS SQL
/** Fetch comments matching %<a href=%[url=% **/
$count_spam_glinks_comments_sql = "SELECT COUNT(ReviewID) AS amount_spam FROM glinks_Reviews WHERE Review_Contents LIKE '%a href=%[url=%'";
$remove_spam_glinks_comments_sql = "DELETE FROM glinks_Reviews WHERE Review_Contents LIKE '%a href=%[url=%'";
echo ("<font face=\"Tahoma,Arial,Helvetica\" size=\"2\">");
?>
<? echo ("<strong>**Deleting Spam Comments**</strong><br /><br />"); ?>
<? // Delete Comments
// count the spam comments
echo ("<strong>Counting Spam Comments...</strong><br />");
$sql = $count_spam_glinks_comments_sql;
$results = mysql_query($sql);
while ($row = mysql_fetch_array($results)) {
echo ("Number of spam comments: ".$row[amount_spam]);
if ($row[amount_spam] > 0) $spam_count = $row[amount_spam];
echo ("<br />\n\r");
}
echo ("<br />");
// end count
// delete the spam comments
//echo ("Comments to be deleted: ".$spam_count);
if ($spam_count > 0) {
echo ("Deleting spam comments...");
$sql = $remove_spam_glinks_comments_sql;
$results = mysql_query($sql);
}
// end delete comments
?>
<? echo ("</font>"); ?>