Skip to content

Instantly share code, notes, and snippets.

@abrahaj
Created July 19, 2015 22:44
Show Gist options
  • Save abrahaj/8922b93e5c30c8a68d75 to your computer and use it in GitHub Desktop.
Save abrahaj/8922b93e5c30c8a68d75 to your computer and use it in GitHub Desktop.
<?php
include "/home/forumi/public_html/library/config.php";
$mysqli = new mysqli($config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['dbname']);
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
$sql="SELECT *
FROM `xf_conversation_message`
WHERE message
REGEXP 'xxxx'
ORDER BY `xf_conversation_message`.`message_id` DESC
LIMIT 0 , 5";
$yesterday = time() - (24 * 60 * 60);
$line="";
if ($result = $mysqli->query($sql)) {
while($obj = $result->fetch_object()){
if ($obj->message_date>$yesterday){
$line.=gmdate("Y-m-d\TH:i:s\Z", $obj->message_date)." - ";
$line.=$obj->message_date." - " ;
$line.=$obj->username. PHP_EOL;
}
}
}
if (!empty($line)) {
$line "Mesazhe qe permbajne termin: xxxxx tek AF". PHP_EOL;
$to = '';
$subject = 'Spam AlbForumi';
$message = $line;
$headers = 'From: mos-kthe-pergjigje@albforumi.com' . "\r\n" .
'Reply-To: mandi@shqiperia.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
//print_r ($line);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment