MI6

Untitled

MI6
Jan 28th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.09 KB | None | 0 0
  1. <?
  2. set_time_limit(0);
  3. //CONFIG
  4. $n = "\n<br>";
  5. function isset_or(&$check, $alternate = NULL) {
  6.     return (isset($check)) ? (empty($check) ? $alternate : $check) : $alternate;
  7. }
  8.  
  9. if($_POST['submit'] == "send") {
  10.     $user = $_POST['user'];
  11.     $pass = $_POST['pass'];
  12.     $site = isset_or($_POST['site'],"ts2.travian.co.uk");
  13.     $sleep = isset_or($_POST['sleep'], 10);
  14.     $namesP = $_POST['names'];
  15.     $title = str_replace("\\", "", $_POST['title']);
  16.     $message = str_replace("\\", "", $_POST['message']);
  17.    
  18.     $names = explode("\n", $namesP);
  19.    
  20.     //print_r($names);
  21.     //echo $n;
  22.    
  23.     // BEGINNETH YE OLDE cURL
  24.     $ch = curl_init();
  25.    
  26.     // Get LOGIN ID
  27.     $loginURL = "http://".$site."/login.php".$n;
  28.    
  29.     curl_setopt($ch, CURLOPT_URL, $loginURL);
  30.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  31.     $loginpg = curl_exec($ch);
  32.     preg_match_all('#<input type="hidden" name="login" value="([0-9]+)" />#', $loginpg, $sess, PREG_SET_ORDER);
  33.     foreach($sess as $ses)
  34.         $sessionid = $ses[1];
  35.    
  36.     // LOGIN
  37.     curl_setopt($ch, CURLOPT_URL, 'http://'.$site.'/dorf1.php');
  38.     curl_setopt($ch, CURLOPT_POST, 1);
  39.     curl_setopt($ch, CURLOPT_POSTFIELDS, 'lowRes=1s1=Login&name='.$user.'&password='.$pass.'&login='.$sessionid);
  40.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  41.     curl_setopt($ch, CURLOPT_COOKIEJAR, $user.'_cookies.txt');
  42.     curl_exec($ch);
  43.     curl_close($ch);
  44.        
  45.     echo "Running pm script on the server: http://".$site."/".$n;
  46.     // SEND PM
  47.     foreach($names as $name) {
  48.         $name = trim($name);
  49.        
  50.         $ch = curl_init();
  51.         curl_setopt($ch, CURLOPT_URL, 'http://'.$site.'/nachrichten.php');
  52.         curl_setopt($ch, CURLOPT_POST, 1);
  53.         curl_setopt($ch, CURLOPT_POSTFIELDS, 's1=send&c=4f1&an='.$name.'&be='.$title.'&message='.$message);
  54.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  55.         //curl_setopt($ch, CURLOPT_REFERER, 'http://'.$site.'/nachrichten.php?t=1&id='.$userID);
  56.         curl_setopt($ch, CURLOPT_COOKIEFILE, $user.'_cookies.txt');
  57.         curl_exec($ch);
  58.         echo "Sent to ".$name.". Waiting ".$sleep." seconds until next pm. ";
  59.         echo '<small>(s1=send&c=4f1&an='.$name.'&be='.$title.'&message='.$message.')</small>'.$n;
  60.        
  61.         curl_close($ch);
  62.         sleep($sleep);
  63.     }
  64.    
  65.     echo "All PMs sent. I think... :P";
  66. }
  67. else {
  68.     echo "<!DOCTYPE html>
  69.     <html>
  70.         <head></head>
  71.         <body>
  72.             <form action='travspam.php' method='POST'>
  73.                 <select name='site'>
  74.                     <option value='ts2.travian.co.uk'>ts2.travian.co.uk</option>
  75.                     <option value='ts4.travian.co.uk'>ts4.travian.co.uk</option>
  76.                     <option value='ts5.travian.co.uk'>ts5.travian.co.uk</option>
  77.                 </select><br>
  78.                 Sleep: <input type='text' name='sleep' value='Seconds to wait between each pm (no decimals, just plain number)'/><br>
  79.                 User: <input type='text' name='user' value='Username to send from'/> Pass: <input type='password' name='pass' value='User password'/><br>
  80.                 Title: <input type='text' name='title' value='Enter title name'/><br>
  81.                 Message: <textarea name='message'>Enter message here.</textarea><br>
  82.                 Players: <textarea name='names'>Enter player names here, one per line.</textarea><br>
  83.                 <input type='submit' name='submit' value='send'/>
  84.             </form>
  85.         </body>
  86.     </html>";
  87. }
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment