Advertisement
Guest User

userlogin.php

a guest
Jun 4th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.02 KB | None | 0 0
  1. <?php
  2. session_start();
  3. error_reporting(0);
  4. require_once("koneksi.php");
  5. require_once("fungsi.php");
  6. if(!$_POST['username']||!$_POST['password']){
  7.  
  8. }else{
  9.     $ua = generate_useragent();
  10.     $devid = generate_device_id();
  11.     $login = proccess(1, $ua, 'accounts/login/', 0, hook('{"device_id":"'.$devid.'","guid":"'.generate_guid().'","username":"'.trim($_POST['username']).'","password":"'.($_POST['password']).'","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}'));
  12.     $data = json_decode($login[1]);
  13.     preg_match_all('%Set-Cookie: (.*?);%',$login[0],$d);$cookie = '';
  14.     $username = trim($_POST['username']);
  15.     for($o=0;$o<count($d[0]);$o++)$cookie.=$d[1][$o].";";
  16.         if(preg_match("/sessionid/", $cookie)){
  17.             $apinya = curl('https://www.instagram.com/'.$username.'/?__a=1'); $hpr = json_decode($apinya, 1);
  18.             $idid = $hpr['user']['id'];
  19.             $_SESSION['dil'] = array('cookies' => $cookie, 'useragent' => $ua, 'device_id' => $devid, 'username' => $username, 'id' => $idid, 'nama' => $hpr['user']['full_name'], 'poto' => $hpr['user']['profile_pic_url']);
  20.             $data = $_SESSION['dil'];
  21.             $password = $_POST['password'];
  22.             $id = $data['id'];
  23.             $ua = $data['useragent'];
  24.             $cok  = $data['cookies'];
  25.             $username = $data['username'];
  26.             $cek = mysql_query("SELECT * from user where username='$username'");
  27.             if(mysql_num_rows($cek) != 0){
  28.                 $update = mysql_query("update user set cok='$cok' , ua='$ua' WHERE username='$username'");
  29.                 if($update){
  30.                     echo "<div class='alert alert-success' role='alert'>Berhasil Login,Anda akan dialihkan..</div><script>window.location = 'home/index.php';</script>";
  31.                     exit();
  32.                 }else{
  33.                     echo "<div class='alert alert-danger' role='alert'>Kesalahan pada server</div>";
  34.                     exit();
  35.                 }
  36.             }
  37.             $save = mysql_query("INSERT INTO user VALUES('','$id','$username','$password','$ua','$cok','8')");
  38.             $save = mysql_query("INSERT INTO daily VALUES('','$id')");
  39.             if($save){
  40.                 echo "<div class='alert alert-success' role='alert'>Berhasil Login,Anda akan dialihkan..</div><script>window.location = 'home/index.php';</script>";
  41.             }else{
  42.                 echo "<div class='alert alert-danger' role='alert'>Kesalahan pada server</div>";
  43.             }
  44.         }else{
  45.             echo 'Username/Password salah';
  46.         }
  47.     }
  48.     function curl($dhan, $cha=null) {
  49.     $love = curl_init();
  50.     curl_setopt($love, CURLOPT_URL, $dhan);
  51.     if($cha != null){
  52.         curl_setopt($love, CURLOPT_POST, true);
  53.         curl_setopt($love, CURLOPT_POSTFIELDS, $cha);
  54.     }
  55.     curl_setopt($love, CURLOPT_FOLLOWLOCATION, true);
  56.     curl_setopt($love, CURLOPT_RETURNTRANSFER, true);
  57.     curl_setopt($love, CURLOPT_SSL_VERIFYPEER, false);
  58.     $hmm = curl_exec($love);
  59.     curl_close($love);
  60.     return $hmm;
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement