/** * Return rendered template * * @param $partial - partial filename * @param null $data - data to inject to view (partial) * @param bool $return - if true return as variable, if false echo out * * @throws Exception */ function get_partial($partial, $data = null, $return = false) { $file_path = get_partial_path($partial); if ($return) { return renderInternal($file_path, $partial, $data, $return); } renderInternal($file_path, $partial, $data, $return); }
<?php require './PHPMailer/autoload.php'; $title = "Cơ hội nhận được Iphone 6! Tham gia ngay kẽo lỡ."; $content = renderInternal('iphone6'); $curr = (int)file_get_contents("./curr.dat"); foreach(file('emails.dat', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $i=>$email){ file_put_contents("./curr.dat", $i); if($i>$curr && isValid($email)){ echo "================================\n"; echo "{$i} -> {$email}\n"; echo "================================\n"; sendMail($email, $title, $content); sleep(rand(11, 20)); } } function isValid($email){ $not = array('facebook.com', 'taembe.com', 'trangcall.com', 'google.com', 'friend.com' ,'eic.com.vn', 'daiphuc.com.vn', 'jp.com.vn', 'lhc.vn'); if(preg_match('/([^\@]+)$/', $email, $matches)){ if(!in_array($matches[1], $not) && checkMxPorts($matches[1])){ return true; } } return false; } function checkMxPorts($domain) {