SHARE
TWEET

Untitled

a guest Nov 13th, 2015 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/php
  2. <?php
  3. $db = new mysqli("<server>", "<user>", "<password>", "<database>");
  4. if ($db->connect_error > 0) {
  5.     die(fwrite(STDOUT,"ERR\n"));
  6. }
  7.  
  8. while (!feof(STDIN))
  9. {
  10.     $i = trim(fgets(STDIN));
  11.     $s = explode(" ", $i);
  12.     $dst = $s[0];
  13.  
  14.     $row = array();
  15.     $query = "SELECT * FROM squid WHERE name = '$dst'";
  16.  
  17.     if ($res = $db->query($query)) {
  18.         $row = $res->fetch_row();
  19.         $rec = $res->num_rows;
  20.  
  21.         if (($row[2] == 1) || ($rec < 1))
  22.            fwrite(STDOUT,"ERR\n"); else
  23.            fwrite(STDOUT,"OK\n");
  24.  
  25.         $res->close();
  26.     }
  27. }
  28.  
  29. $mysqli->close();
  30. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top