$banOnProbability) { return true; } else { if ($response < 0 || strcmp($response, "") == 0 ) { //The server returned an error, you might want to do something //like write to a log file or email yourself //This could be true due to an invalid input or you've exceeded //the number of allowed queries. Figure out why this is happening //because you aren't protected by the system anymore //Leaving this section blank is dangerous because you assume //that you're still protected, which is incorrect //and you might think GetIPIntel isn't accurate anymore //which is also incorrect. //failure to implement error handling is bad for the both of us } return false; } } public static function isJunkMail($mail) { $domains = array('pjjkp.com', 'ephemail.com', 'ephemail.org', 'ephemail.net', 'jetable.org', 'jetable.net', 'jetable.com', 'yopmail.com', 'haltospam.com', 'tempinbox.com', 'brefemail.com', '0-mail.com', 'link2mail.net', 'mailexpire.com', 'kasmail.com', 'spambox.info', 'mytrashmail.com', 'mailinator.com', 'dontreg.com', 'maileater.com', 'brefemail.com', 'yopmail.com', '0-mail.com', 'brefemail.com', 'ephemail.net', 'guerrillamail.com', 'guerrillamail.info', 'haltospam.com', 'iximail.com', 'jetable.net', 'jetable.org', 'kasmail.com', 'klassmaster.com', 'kleemail.com', 'link2mail.net', 'mailin8r.com', 'mailinator.com', 'mailinator.net', 'mailinator2.com', 'myamail.com', 'mytrashmail.com', 'nyms.net', 'shortmail.net', 'sogetthis.com', 'spambox.us', 'spamday.com', 'Spamfr.com', 'spamgourmet.com', 'spammotel.com', 'tempinbox.com', 'yopmail.com', 'yopmail.fr', 'guerrillamail.org', 'temporaryinbox.com', 'spamcorptastic.com', 'filzmail.com', 'lifebyfood.com', 'tempemail.net', 'spamfree24.org', 'spamfree24.com', 'spamfree24.net', 'spamfree24.de', 'spamfree24.eu', 'spamfree24.info', 'spamherelots.com', 'thisisnotmyrealemail.com', 'slopsbox.com', 'trashmail.net', 'myamail.com', 'tyldd.com', 'safetymail.info', 'brefmail.com', 'bofthew.com', 'trash-mail.com'); list($user,$domain) = explode('@',$mail); return in_array($domain,$domains); } public static function getMyIp() { $ipaddress = ''; if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP']; else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED']; else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED']; else if(isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR']; else $ipaddress = 'UNKNOWN'; return $ipaddress; } public static function logjs($data) { $html = ''; if(is_array($data) || is_object($data)) { $html = ""; } else { $html = ""; } echo($html); } public static function log($log) { DB::insert('log', array('log'=>$log)); } public static function createThumbnail($source, $target, $width = 128) { $finalWidth=$width."x".$width; $cmd = "convert $source -thumbnail -background black '$finalWidth>' $target"; exec($cmd); return "$cmd"; } public static function createCroppedThumbnail($source, $target, $width, $height) { $finalWidth=$width."x".$width; $cmd = "convert $source -background black -thumbnail $finalWidth^ -gravity center -extent $finalWidth $target"; exec($cmd); //echo $cmd; return "$cmd"; } public static function sendEmailWithTemplate($to, $subject, $from, $template="template.html") { ob_start(); include(__DIR__."/../email/$template"); $body = ob_get_clean(); self::sendEmailSMTP($to, $subject, $body, $from); } public static function sendEmailSMTP($to, $subject, $message, $from, $debug=false) { require_once(__DIR__.'/phpmailer/class.phpmailer.php'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail->SMTPDebug = $debug; $mail->Host = SMTPHost; $mail->SMTPDebug = SMTPDebug; $mail->SMTPAuth = SMTPAuth; $mail->Port = SMTPPort; $mail->Username = SMTPUsername; $mail->Password = SMTPPassword; $mail->SMTPSecure = "ssl"; $mail->IsHTML(true); $mail->CharSet = 'UTF-8'; $mail->AddAddress($to, $to); $mail->SetFrom($from, $from); $mail->AddReplyTo($from, $from); $mail->Subject = $subject; $mail->MsgHTML($message); //$mail->Body = $message; //die($message); $res = $mail->Send(); // die("SENT to:$to, $subject, $from $message"); return "ok"; } public static function sendEmail($to, $name, $subject, $body, $from, $debug=false) { $headers = "From: $from\r\n"; $headers.= "MIME-Version: 1.0\r\n"; $headers.= "Content-Type: text/html; charset=utf-8\r\n"; $headers.= "X-Priority: 1\r\n"; if (USESMTP) { Services::sendEmailSMTP($to, $subject, $body, $from, $debug); } else { mail($to, $subject, $body, $headers); } } }