Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.39 KB | None | 0 0
  1. <?php
  2. set_time_limit(855);
  3.  $con = mysqli_connect('localhost','nadeem00_toplist','nestle123456','nadeem00_toplist');
  4.  //$con = mysqli_connect('localhost','root','','topfive');
  5.  function send_sms(){
  6.     global $con;
  7.     $username = 923155700444;
  8.     $password = 2781;
  9.     $From  = 'Toplist.pk';
  10.     $sql = "SELECT * FROM sms WHERE status =0 order by id ASC";
  11.     $query = mysqli_query($con,$sql);
  12.         if (!$query) {
  13.         echo 'MySQL Error: ' . mysqli_error();
  14.         }
  15.      $rowcount=mysqli_num_rows($query);
  16.    
  17.     if($rowcount > 0){
  18.         while($row = mysqli_fetch_assoc($query)){
  19.                 $msg    = urlencode($row['message']);  
  20.             $number = $row['number'];
  21.             $id     = $row['id'];
  22.             $api =("http://sendpk.com/api/sms.php?username=$username&password=$password&sender=$From&mobile=$number&message=$msg");
  23.          $response = file_get_contents($api);
  24.             $res = explode(' ', $response , 2);
  25.             if(trim($res[0]) == 'OK'){
  26.                     $status =1;
  27.                
  28.             } else {
  29.                    $status =2;
  30.                    
  31.                 }
  32.                   $sql = "UPDATE sms SET status='$status' WHERE id='$id'";
  33.                   $query = mysqli_query($con,$sql);
  34.        
  35.         }
  36.     }
  37.      
  38.  }
  39.  $starttime = microtime(true);
  40.  for ($i=0; $i<=111; $i++){
  41.      $now = microtime(true) -$starttime;
  42.      if ($now > 892) {
  43.          break;
  44.       }
  45.      send_sms();   
  46.      sleep(8);
  47.  }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement