Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.00 KB | None | 0 0
  1. <?php
  2. //header ('Content-type: text/html; charset=utf-8');
  3.  
  4.  
  5. $SendMail = "efmircdma@gmail.com";
  6.  
  7. class LastronMailer {
  8.     public function replice($string){
  9.         $string = preg_replace("/</si","&lt;",$string);
  10.         $string = preg_replace("/>/","&gt;",$string);
  11.         $string = trim($string);
  12.         return($string);
  13.     }
  14.  
  15.     public function LoadData($string){
  16.         // ------- определяем массив для месяцев ----------
  17.         $q = array(); // обнуляем массив
  18.         $q[]= "";
  19.         $q[]= "января";             $q[]= "февраля";            $q[]= "марта";
  20.         $q[]= "апреля";             $q[]= "мая";                $q[]= "июня";
  21.         $q[]= "июля";               $q[]= "августа";            $q[]= "сентября";
  22.         $q[]= "октября";            $q[]= "ноября";             $q[]= "декабря";
  23.         // ------- определяем массив для дней недели ----------
  24.         $e = array();
  25.         $e[]="воскресенье";         $e[]="понедельник";
  26.         $e[]="вторник";             $e[]="среда";
  27.         $e[]="четверг";             $e[]="пятница";
  28.         $e[]="суббота";
  29.  
  30.         $m          = date('m'); // ---- считываем месяц
  31.         $m          = intval($m);
  32.         $den        = date('w'); // ---- считываем день недели
  33.         $chislo     = date('d'); // ---- считываем число
  34.         $den_nedeli = @$e[$we]; // ---- извлекаем из массива соответствующее значение дня недели
  35.         $mesyac     = $q[$m]; // ---- извлекаем из массива соответствующее значение месяца
  36.         $god        = date('Y');
  37.  
  38.         if ($string == 1){
  39.             $data_time = $den_nedeli . " " . $chislo . " " . $mesyac;
  40.             return $data_time;
  41.         }
  42.     }
  43.  
  44.     private function SendMail($to, $subject, $text, $from, $file, $type){
  45.         $uid = strtoupper(md5(uniqid(time())));
  46.         $header = "From: ".$from."\nReply-To: ".$from."\n";
  47.         $header .= "LASTRON-MAIL: v1.0\n";
  48.         $header .= "Content-Type: multipart/mixed; boundary=".$uid."\n";
  49.  
  50.         $header .= "--".$uid."\n";
  51.         $header .= "Content-type: text/html; charset=". $type . "\r\n";
  52.         $header .= "Content-Transfer-Encoding: 8bit\n\n";
  53.         $header .= $text."\n";
  54.         $header .= "--".$uid."--";
  55.  
  56.         if(@mail($to, $subject, "", $header)){ return true;}
  57.         else {return false;}
  58.     }
  59.  
  60.     public function Send($Name){
  61.         if($this->SendMail($Name['1'], $Name['2'], $Name['7'], $Name['4'], $Name['5'], $Name['6'])){
  62.             return true;
  63.         }
  64.         else{
  65.             return false;
  66.         }
  67.     }
  68.  
  69.     public function isMail ($mail){
  70.         return preg_match("/^([\w\.\-])+@([\w\.\-]+\\.)+[a-z]{2,6}$/i", $mail);
  71.     }
  72.  
  73.     public function isName ($name){
  74.         return preg_match("/^[A-zА-я]+$/i", $name);
  75.     }
  76.  
  77.     public function isPhone ($phone){
  78.         return preg_match("/^[0-9\+\s]+$/i", $phone);
  79.     }
  80.  
  81.     public function isCity ($city){
  82.         return preg_match("/^[A-zА-я]+$/i", $city);
  83.     }
  84. }
  85.  
  86. function htmlForm(){
  87.     global $errName, $errPhone, $errMail, $errCity;
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement