Advertisement
Guest User

Untitled

a guest
Nov 27th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. $username = "root";
  2. $password = "luca170385";
  3. $hostname = "localhost";
  4.  
  5. $dbhandle = mysqli_connect($hostname, $username, $password)
  6. or file_put_contents($filename, date("Y-m-d H:i:s")."Unable to connect to database", FILE_APPEND);
  7. echo "Connect to MySQL<br>";
  8.  
  9. $selected = mysqli_select_db($dbhandle , "accounts")
  10. or file_put_contents($filename, date("Y-m-d H:i:s")."Could not select database<br>", FILE_APPEND);
  11. echo "Selected Database<br>";
  12.  
  13. $sql = "SELECT `address` FROM `url` WHERE `code` IS NULL";
  14.  
  15. if ($result = mysqli_query($dbhandle, $sql)){
  16.  
  17. while ($row = mysqli_fetch_assoc( $result));{
  18. printf ($row['address']);
  19. $output = "{$row['address']}";
  20. echo "{$row['address']}";
  21. $handle = curl_init($sql);
  22. curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
  23.  
  24. $response = curl_exec($handle);
  25.  
  26. $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
  27. $update = "UPDATE url SET `code`= $httpCode WHERE `address` = $sql";
  28. echo "$update.<br>";
  29. echo "$handle.<br>";
  30. echo "$httpCode.<br>";
  31.  
  32. mysqli_query($dbhandle, $update);
  33. echo "{$row['address']}";
  34.  
  35. curl_close($handle);
  36. }
  37. }else {
  38. echo 'Not working';
  39. }
  40.  
  41. while ($row = mysqli_fetch_assoc( $result));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement