Server IP : 127.0.0.2 / Your IP : 3.147.28.162 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/admin/ |
Upload File : |
<?php ini_set('max_execution_time', 900); //300 seconds = 5 minutes ob_start(); session_start(); require_once('session-check.php'); require_once('include/db-config.php'); $messagetype = ""; $emailtitle = ""; $fromemail = ""; $content = ""; $filename= ""; //$sendfailed = $_POST['sendfailed']; if(isset($_POST['sendfailed'])) $sendfailed = "checked"; else $sendfailed = "not checked"; $filterby = $_POST['filterby']; $emailids = $_POST['emailids']; $messageId = $_POST['id']; // getting message details based on the selection $sql = "select ID, FileName, EmailTitle, MessageType, EmailText, SendDate, FromEmailID, IsDelete from maintrainer_emailmessage where ID = ".$messageId; $result=mysqli_query($conn,$sql); if($row=mysqli_fetch_array($result)) { $messagetype = $row['MessageType']; $emailtitle = $row['EmailTitle']; $fromemail = $row['FromEmailID']; $content = $row['EmailText']; $filename = $row['FileName']; } if($sendfailed == "checked") { if($filterby == "All") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 "; } else if($filterby == "Country") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 and tb1.Country = '".$emailids."'"; } else if($filterby == "State") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 and tb1.State = '".$emailids."'"; } else if($filterby == "City") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 and tb1.City = '".$emailids."'"; } else if($filterby == "Company") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 and tb1.CompanyName = '".$emailids."'"; } else if($filterby == "Title") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 and tb1.Title = '".$emailids."'"; } else if($filterby == "Person") { $sql = "SELECT tb1.ID, tb1.EmailID from maintrainer_emaildetails tb1 WHERE tb1.ID NOT IN (SELECT tb2.MemberID FROM maintrainer_emailhistory tb2 WHERE tb2.MessageID = ".$messageId.") and tb1.Status = 1 and tb1.EmailID = '".$emailids."'"; } } else { if($filterby == "All") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1"; } else if($filterby == "Country") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1 and Country = '".$emailids."'"; } else if($filterby == "State") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1 and State = '".$emailids."'"; } else if($filterby == "City") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1 and City = '".$emailids."'"; } else if($filterby == "Company") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1 and CompanyName = '".$emailids."'"; } else if($filterby == "Title") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1 and Title = '".$emailids."'"; } else if($filterby == "Person") { $sql = "select ID, EmailID from maintrainer_emaildetails where Status = 1 and EmailID = '".$emailids."'"; } } $SendDate=date("Y-m-d "); $from = $fromemail; $subject = $emailtitle; $message_html = ""; // OLD CODE (WIHOUT FILE ATTACHMENT if($messagetype == "plain") { $headers='From: '.$from. "\r\n" . 'Reply-To: '.$from. "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = $content; $message_html = nl2br($content); } else { $headers = "From: ".$from."\r\n"; $headers .= "Reply-To: ".$from."\r\n"; $headers .= "Return-Path: ".$from."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message = $content; $message_html = $content; } //$fileatt_type = "application/octet-stream"; // File Type if(trim($filename) != "") { $fname = $filename; $fileatt_type = "application/octet-stream"; $fileatt_name = $fname; $headers = "From: ".$from."\r\n"; $headers .= "Reply-To: ".$from."\r\n"; $headers .= "Return-Path: ".$from."\r\n"; $file = fopen("upload/".$fname,'r'); $data = fread($file,filesize("upload/".$fname)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; $message .= "This is a multi-part message in MIME format.\r\n\r\n" . "--{$mime_boundary}\r\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n" . $message_html . "\n\n"; $data = chunk_split(base64_encode($data)); $message .= "--{$mime_boundary}\r\n" . "Content-Type: {$fileatt_type};\r\n" . " name=\"{$fileatt_name}\"\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n" . $data . "\r\n\r\n" . "--{$mime_boundary}--\r\n"; } else { $message = $content; } $result=mysqli_query($conn,$sql); while($row=mysqli_fetch_array($result)) { $ID = $row['ID']; $EmailID = trim($row['EmailID']); //$EmailID = "anishk008@gmail.com"; $to = $EmailID; if (mail($to, $subject, $message, $headers)) { $sql2 = "update maintrainer_emaildetails set MessageSent = MessageSent+1 where ID = ".$ID; //$sql2 = "update maintrainer_emaildetails set MessageSent = MessageSent+1 where ID = 80"; $result2=mysqli_query($conn,$sql2); } else { $sql2 = "update maintrainer_emaildetails set MessageFailed = MessageFailed+1 where ID = ".$ID; $result2=mysqli_query($conn,$sql2); } // last record = 1290 //$sql2 = "insert into maintrainer_emailhistory(FromEmailID, MemberID, MessageID, SendDate, SendStatus) values('".$fromemail."', ".$ID.", ".$messageId.", '".$SendDate."', '".$SendStatus."')"; $sql2 = "insert into maintrainer_emailhistory(FromEmailID, MemberID, MessageID, SendDate, SendStatus) values('".$fromemail."', ".$ID.", ".$messageId.", '".$SendDate."', '".$SendStatus."')"; $result2=mysqli_query($conn,$sql2); } $url = "Location: email-send-result.php?r=3&id=".$messageId; header($url);