PalmaSolutions

index55.php

May 5th, 2018
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.36 KB | None | 0 0
  1. <html>
  2. <head>
  3.   <title>Mail</title>
  4. <style type="text/css">
  5. body {font-family: Arial, Helvetica, sans-serif;font-size: 11px;}
  6. td {font-family: Arial, Helvetica, sans-serif;font-size: 11px;}
  7. h1 {font-family: Arial, Helvetica, sans-serif;font-size: 16px; color:#72BA75; }
  8. a {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color : #000000;text-decoration: underline;}
  9. a:hover{font-family: Arial, Helvetica, sans-serif;font-size: 11px;color : #294A7B;text-decoration: none;}
  10. .buttona {border: 1px solid #B9BAC8;background-color:#FFFFFF; font-size:11px;padding:0px;height: 21px;font-family:Tahoma;width:100px;}
  11. INPUT.inp {border: 1px solid #B9BAC8;background-color:#FFFFFF; font-size:11px;height: 18px; font-family:Arial;width:200px;}
  12. textarea.inp {border: 1px solid #B9BAC8;background-color:#FFFFFF; font-size:11px; font-family:Arial;height:100px;width:564px;}
  13. .tdheader {
  14.     width:100px;
  15. }
  16. </style>
  17. <script type="text/javascript">
  18. function cleared() {
  19.   var name_input = document.getElementById("fname1")
  20.   name_input.value=""
  21.   var name_input = document.getElementById("fname2")
  22.   name_input.value=""
  23.   var name_input = document.getElementById("fname3")
  24.   name_input.value=""
  25. }
  26.  
  27. function single() {
  28.  var disabled = document.getElementById("disabled")
  29.  disabled.disabled = false
  30.  var mesdisabled = document.getElementById("messagelist")
  31.  mesdisabled.disabled = "disabled"
  32. }
  33.  
  34. function singlefrom() {
  35.  var disabled1 = document.getElementById("fromtext")
  36.  disabled1.disabled = false
  37.  var mesdisabled1 = document.getElementById("fromlist")
  38.  mesdisabled1.disabled = "disabled"
  39. }
  40.  
  41. function listfrom() {
  42.  var disabled1 = document.getElementById("fromtext")
  43.  disabled1.disabled = "disabled"
  44.  var mesdisabled1 = document.getElementById("fromlist")
  45.  mesdisabled1.disabled = false
  46. }
  47.  
  48. function list() {
  49.  var disabled = document.getElementById("disabled")
  50.  disabled.disabled = "disabled"
  51.  var mesdisabled = document.getElementById("messagelist")
  52.  mesdisabled.disabled = false
  53. }
  54.  
  55. function listsubject() {
  56.  var subjtype = document.getElementById("singlesubj")
  57.  var subjtype2 = document.getElementById("listsubj")
  58.  if(subjtype.disabled == true) {
  59.   subjtype.disabled = false
  60.   subjtype2.disabled = true
  61.  } else {
  62.   subjtype2.disabled = false
  63.   subjtype.disabled = true
  64.  }
  65. }
  66. </script>
  67. </head>
  68. <body>
  69.  
  70. <?php
  71. error_reporting(0);
  72. $message_in_min = 10000;
  73. $mode = $HTTP_POST_VARS['mode'];
  74.  
  75. switch($mode){
  76.   case 'send':
  77.     if(isset($HTTP_POST_FILES['filename']['tmp_name'])){
  78.     $attach = '';
  79.     for($h=0;$h<count($HTTP_POST_FILES['filename']['name']);$h++) {
  80.         if(empty($HTTP_POST_FILES['filename']['name'][$h])) {
  81.             continue;
  82.         }
  83.         $base_name[$h] = $HTTP_POST_FILES['filename']['name'][$h];
  84.         $f = fopen($HTTP_POST_FILES['filename']['tmp_name'][$h],"rb");
  85.         $attach[$h]= base64_encode(fread($f,filesize($HTTP_POST_FILES['filename']['tmp_name'][$h])));
  86.         $isfile = 1;
  87.     }
  88.     }
  89.     else {$isfile = 0;}
  90.     if($_POST['fromtype']=='Single') {
  91.         $fromname = @$HTTP_POST_VARS['from'];
  92.     }
  93.     if($_POST['fromtype']=='List') {
  94.         $listf=1;
  95.         $msgfile=file($_FILES['fromlist']['tmp_name']);
  96.     }
  97.     if(isset($fromname)){$from="<".$fromname.">";}
  98.     $subjtype = $_POST['subjtype'];
  99.     if($subjtype=='List') {
  100.       $subject = file(@$HTTP_POST_FILES['subject']['tmp_name']);
  101.     } else {
  102.       $subjtext = $_POST['subject'];
  103.     }
  104.     $type = $HTTP_POST_VARS['type'];
  105.     if($_POST['mestype']=='Single') {
  106.      $message = $HTTP_POST_VARS['message'];
  107.     }
  108.     if($_POST['mestype']=='List') {
  109.     if(isset($_FILES['messagelist']['tmp_name'])) {
  110.         $messagelist=file_get_contents($_FILES['messagelist']['tmp_name']);
  111.         $messagearr = explode("###",$messagelist);
  112.         $listm=1;
  113.         $message="LIST!";
  114.     } else {
  115.         die('Message file not found!');
  116.     }
  117.     }
  118.     if($type == 'text'){$message =  htmlspecialchars(stripslashes($message));}
  119.     if(!$message){echo("Empty message"); exit;}
  120.     ############################################################################
  121.    $to_arr = file(@$HTTP_POST_FILES['to']['tmp_name']);
  122.     $i = 0;
  123.     $current_message= 0;
  124.     $num_send = 0;
  125.     $num_bad  = 0;
  126.     $num_error= 0;
  127.     while(isset($to_arr[$i])){
  128.       $to_arr[$i] = trim($to_arr[$i]);
  129.     if(is_array($subject)) {
  130.      $r=rand(0,(count($subject)-1));
  131.      $lsubject=trim($subject[$r]);
  132.     } else {
  133.      $lsubject=$subjtext;
  134.     }
  135.     if($listm==1) {
  136.         if($listf==1) {
  137.             $fr=rand(0,(count($msgfile)-1));
  138.             $from="<".trim($msgfile[$fr]).">";
  139.         }
  140.         $t=rand(0,(count($messagearr)-1));
  141.         $messagearr[$t]=trim($messagearr[$t]);
  142.             if(sendemail($from,$to_arr[$i],$lsubject,$messagearr[$t],$type)){
  143.                 echo('Message to '.$to_arr[$i]." sent<br>\n"); flush();
  144.                 $num_send++;
  145.             }else{$num_error++;}
  146.     } else {
  147.         if($listf==1) {
  148.             $fr=rand(0,(count($msgfile)-1));
  149.             $from="<".trim($msgfile[$fr]).">";
  150.         }
  151.         if(sendemail($from,$to_arr[$i],$lsubject,$message,$type)){
  152.                 echo('Message to '.$to_arr[$i]." sent<br>\n"); flush();
  153.                 $num_send++;
  154.             }else{$num_error++;}
  155. }
  156.       $current_message++;
  157.       if($current_message == $message_in_min){
  158.         $current_message = 0;
  159.         echo('Sent '.$message_in_min.' messages. Pause 60 sec.'."<br>\n");
  160.         flush();
  161.         sleep(30);
  162.         echo('<!---->'."\n");
  163.         flush();
  164.         sleep(30);
  165.       }
  166.       $i++;
  167.     }
  168.     echo('<hr size="1" color="#000000">Spam completed!<br>'."\n");
  169.     echo('
  170.      <b>Sent  : '.$num_send.'</b>
  171.      <b>Errors: '.$num_error.'</b>
  172.      <b>bad emails: '.$num_bad.'</b>
  173.      <hr size="1" color="#000000">
  174.    ');
  175.   break;
  176.   default:
  177.     echo('
  178. <div align="center">
  179. <table align="center" width=800 border=0>
  180. <tr>
  181. <td>
  182. <table align="left"><form method="post" enctype="multipart/form-data">
  183. <tr>
  184.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>From (Email):</strong><br />Single:<input type="radio" value=\'Single\' onclick="singlefrom()" name=\'fromtype\' checked></td>
  185.  <td><input type="Text" class="inp" name="from" value="" size="30" id="fromtext"> * - email only</td>
  186. </tr>
  187. <tr>
  188.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>From (Email):</strong><br />List:<input type="radio" value=\'List\' onclick="listfrom()" name=\'fromtype\'></td>
  189.  <td><input type="File" name="fromlist" id="fromlist" class="inp" size="68" disabled></td>
  190. </tr>
  191. <tr>
  192.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>To:</strong></td>
  193.  <td><input type="File" name="to" class="inp" size="68"></td>
  194. </tr>
  195. <tr>
  196.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Subject</strong><br />Single:<input type="radio" value=\'Single\' onclick="listsubject()" name=\'subjtype\' checked></td>
  197.  <td><input type="Text" class="inp" name="subject" value="" size="30" id="singlesubj"> * - subject only</td>
  198. </tr>
  199. <tr>
  200.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Subject</strong><br />List:<input type="radio" value=\'List\' onclick="listsubject()" name=\'subjtype\'></td>
  201.  <td><input type="File" name="subject"  id="listsubj" class="inp" size="68" disabled></td>
  202. </tr>
  203. </table>
  204. </td>
  205. </tr>
  206. <tr>
  207. <td>
  208. <table align="left">
  209. <tr>
  210.  <td valign="top" align="right" bgcolor="#EBEBEB" class=tdheader><strong>Message:</strong><br />Single: <input type="radio" value=\'Single\' onclick="single()" name=\'mestype\' checked></td>
  211.  <td><textarea name="message" class="inp" id="disabled"></textarea></td>
  212. </tr>
  213. <tr>
  214.  <td valign="top" align="right" bgcolor="#EBEBEB" class=tdheader><strong>Message:</strong><br />List: <input type="radio" value=\'List\' name=\'mestype\' onclick="list()"></td>
  215.  <td><input type="File" name="messagelist" id="messagelist" class="inp" size="68" disabled></td>
  216. </tr>
  217. </table>
  218. </td>
  219. </tr>
  220. <tr>
  221. <td>
  222. <table align="left" border=0 width=100%>
  223. <tr>
  224.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Attach:</strong></td>
  225.  <td><input type="File" name="filename[]" id="fname1" class="inp" size="68"></td>
  226. </tr>
  227. <tr>
  228.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Attach:</strong></td>
  229.  <td><input type="File" name="filename[]" id="fname2" class="inp" size="68"></td>
  230. </tr>
  231. <tr>
  232. <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Attach:</strong></td>
  233. <td><input type="File" name="filename[]" id="fname3" class="inp" size="68"></td>
  234. </tr>
  235. <tr>
  236. <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Empty:</strong></td>
  237. <td><input type="button" class="buttona" value="Empty attach" onclick="cleared()"></td>
  238. </tr>
  239. </table>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td>
  244. <table align="left">
  245. <tr>
  246.  <td align="right" bgcolor="#EBEBEB" class=tdheader><strong>Format</strong></td>
  247.  <td width=564>
  248.  
  249. <table width="100%" border=0>
  250. <tr>
  251.  <td width="20"><input class="inp" type="Radio" name="type" value="text" checked></td>
  252.  <td width="40">text&nbsp;&nbsp;&nbsp;&nbsp;</td>
  253.  <td width="20"><input class="inp" type="Radio" name="type" value="html"></td>
  254.  <td width="40">html</td>
  255.  <td width="40"></td>
  256.  <td align="right"><input type="Hidden" name="mode" value="send"><input type="Submit" class="buttona" value="Send"></td>
  257. </tr>
  258. </table>
  259.  
  260. </td>
  261. </tr>
  262. </table>
  263. </form>
  264. </td></tr></table>
  265. </div>
  266. ');
  267.   break;
  268. }
  269.  
  270. function sendemail($from,$to,$subject,$message,$type){
  271.   $bound = time().'SPB';
  272.   global $attach, $base_name, $isfile;
  273.  
  274.   $sep = chr(13).chr(10); // ����������� ����� ���������
  275.   switch($type){
  276.     case 'text':
  277.       $headers = "From: ".trim($from).$sep;
  278.       $headers.= "X-Priority: 3".$sep;
  279.       $headers.= "X-MSMail-Priority: Normal".$sep;
  280.       $headers.= "X-Mailer: PHP/".phpversion().$sep;
  281.       $headers.= "MIME-Version: 1.0".$sep;
  282.       $headers.= "Content-Type: multipart/mixed; boundary=\"".$bound."\"".$sep.$sep;
  283.  
  284.       $body = "--$bound".$sep;
  285.       $body.= "Content-type: text/plain; charset=\"windows-1251\"".$sep;
  286.       $body.= "Content-Transfer-Encoding: 8bit".$sep.$sep;
  287.       $body.= $message.$sep;
  288.     for($a=0;$a<count($attach);$a++) {
  289.       if($isfile == 1){
  290.         $body.= "$sep$sep--$bound".$sep;
  291.         $body.= "Content-Type: application/octet-stream;";
  292.         $body.= "name=\"".basename($base_name[$a])."\"".$sep;
  293.         $body.= "Content-Transfer-Encoding:base64".$sep;
  294.         $body.= "Content-Disposition:attachment".$sep.$sep;
  295.         $body.= $attach[$a].$sep;
  296.       }
  297. }
  298.     break;
  299.     case 'html':
  300.       $headers = "From: ".$from.$sep;
  301.       $headers.= "X-Priority: 3".$sep;
  302.       $headers.= "X-MSMail-Priority: Normal".$sep;
  303.       $headers.= "X-Mailer: PHP/".phpversion().$sep;
  304.       $headers.= "MIME-Version: 1.0".$sep;
  305.       $headers.= "Content-Type: multipart/mixed; boundary=\"".$bound."\"".$sep.$sep;
  306.  
  307.       $body = "--$bound".$sep;
  308.       $body.= "Content-type: text/html; charset=\"windows-1251\"".$sep;
  309.       $body.= "Content-Transfer-Encoding: 8bit".$sep.$sep;
  310.       $body.= $message.$sep;
  311. for($a=0;$a<count($attach);$a++) {
  312.       if($isfile == 1){
  313.         $body.= "$sep$sep--$bound".$sep;
  314.         $body.= "Content-Type: application/octet-stream;";
  315.         $body.= "name=\"".basename($base_name[$a])."\"".$sep;
  316.         $body.= "Content-Transfer-Encoding:base64".$sep;
  317.         $body.= "Content-Disposition:attachment".$sep.$sep;
  318.         $body.= $attach[$a].$sep;
  319.       }
  320.       }
  321.     break;
  322.     default:
  323.       echo('<center><b>Invalid type of message.</b></center>');
  324.     break;
  325.   }
  326.   if(mail($to,$subject,$body,$headers)){return true;}
  327.   else{return false;}
  328. }
  329. ?>
  330. </body>
  331. </html>
Advertisement
Add Comment
Please, Sign In to add comment