MI6

Untitled

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