<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$_CONFIG['host'] = "62.149.150.52";
$_CONFIG['user'] = "Sql97522";
$_CONFIG['pass'] = "c7d497e7";
$_CONFIG['dbname'] = "Sql97522_1";
$conn = mysql_connect($_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']) or die('Impossibile stabilire una connessione');
mysql_select_db($_CONFIG['dbname']);
include_once("include/checkM.php");
$quantita = 1;
$inizio = 0;
$query = "SELECT u.email
FROM phplist_listuser l, phplist_user_user u
WHERE u.id = l.userid
AND l.listid = '14'
AND u.blacklisted = '0'
AND u.confirmed = '1'";
$risultato = mysql_query($query) or die("Errore");
$num_rows = mysql_num_rows($risultato);
$num = floor($num_rows / $quantita);
if(isset($_GET['inizio'])) {
$inizio = $_GET['inizio'] + $quantita;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Email</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php
if ($inizio <= $num_rows) {
?>
<script language="JavaScript">
<!--
var sURL = unescape(window.location.pathname);
function doLoad(){
setTimeout( "refresh()", 10*1000 );
}
function refresh(){
window.location.href = sURL+'<?php echo '?inizio='.$inizio.'&limit='.$quantita.''; ?>';
}//--></script>
<body onLoad="doLoad();">
<?php
} else {
?>
<script language="JavaScript"><!-- // inseriamo qui una data per poter verificare che tutto funzioni
document.write('<div class="alert"><b>Le email sono state pulite.</b></div>');//-->
</script>
<?php
}
$query = "SELECT u.email
FROM phplist_listuser l, phplist_user_user u
WHERE u.id = l.userid
AND l.listid = '14'
AND u.blacklisted = '0'
AND u.confirmed = '1'
LIMIT $inizio,$quantita";
$risultato = mysql_query($query) or die(mysql_error());
while ($array = mysql_fetch_array($risultato, MYSQL_BOTH)) {
// get the request query bits
if (strpos($_SERVER["REQUEST_URI"], "?")) {
$QueryString = explode("?", $_SERVER["REQUEST_URI"]);
$QueryArray = explode("&", $QueryString[1]);
foreach ($QueryArray as $QueryItem) {
$QuerySegment = explode("=", $QueryItem, 2);
$_GET[$QuerySegment[0]] = urldecode($QuerySegment[1]);
}
}
// get input parameters
$DEBUG_ENABLED = 1;
$EMAIL_ADDRESS = $array['email'];
$THUNDERPLUNGER_ID = '{bfec0750-aa6f-11db-abbd-0800200c9a66}';
$timerStart;
// check that we are being invoked via the thunderplunger addon
if($THUNDERPLUNGER_ID != THUNDERPLUNGER_GUID)
{
// we ignore this if we are in test mode
if($DEBUG_ENABLED != "")
{
debugOut("No access key provided - ignored");
}
else
{
// otherwise, it is an error
header($_SERVER['SERVER_PROTOCOL'] . " " . ERROR . " Missing or incorrect access key");
header("Status: " . ERROR . " Missing or incorrect access key", true);
return;
}
}
// invoke the email check using the input email address
$checkResult = checkEmail($EMAIL_ADDRESS);
// if we are debugging, output our final conclusion
if($DEBUG_ENABLED != "")
{
if(strcmp($checkResult->GetFirst(), EMAIL_GOOD) == 0)
{
debugOut("$EMAIL_ADDRESS good");
}
else
{
if(strcmp($checkResult->GetFirst(), EMAIL_BAD) == 0)
{
debugOut("$EMAIL_ADDRESS bad");
}
else
{
debugOut("$EMAIL_ADDRESS unsure");
}
}
debugOut($checkResult->GetSecond());
}
// check for leading garbage
$message = ltrim($checkResult->GetSecond(), " ~!@#$%^&*()_+=`';:=-[]{}|\<>.,?/\n");
// only take the first line of a multi-line response
$message = strtok($message, "\n");
debugOut("Message is $message");
// the following header sets the function's status code and message
header($_SERVER['SERVER_PROTOCOL'] . " " . $checkResult->GetFirst() . " " . $message, true, $checkResult->GetFirst());
header("Status: " . $checkResult->GetFirst() . " " . $message, true);
// end of mainline code
return;
// support windows platform (from http://www.php.net/manual/en/function.getmxrr.php#69869)
// which lacks an implementation of the getmxrr() function
if(!function_exists('getmxrr'))
{
function getmxrr($hostname, &$mxhosts, &$mxweight)
{
if(!is_array($mxhosts))
{
$mxhosts = array();
}
if(!empty($hostname))
{
$output = "";
@exec ("nslookup.exe -type=MX $hostname.", $output);
$imx=-1;
foreach($output as $line)
{
$imx++;
$parts = "";
if(preg_match("/^$hostname\tMX preference = ([0-9]+), mail exchanger = (.*)$/", $line, $parts))
{
$mxweight[$imx] = $parts[1];
$mxhosts[$imx] = $parts[2];
}
}
return($imx!=-1);
}
return false;
}
}
}
?>
</body>
</html>