Created
July 19, 2015 22:44
-
-
Save abrahaj/8922b93e5c30c8a68d75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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: [email protected]' . "\r\n" . | |
'Reply-To: [email protected]' . "\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