Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. include 'curl.php';
  4. include 'data.php';
  5. $host = "localhost";
  6. $user = "siteidto_repost";
  7. $pass = "))VgM4gA-]u7";
  8. $db = "siteidto_repost";
  9. $konek = mysql_connect($host, $user, $pass) or die ('Koneksi Gagal! ');
  10. mysql_select_db($db);
  11. $cek = mysql_query("SELECT * FROM ikiganteng WHERE mediaid='$mediaid'");
  12. $cek = mysql_num_rows($cek);
  13. if($cek != 0){
  14. echo "Failed, This photo already uploaded !";
  15. exit();
  16. } else {
  17. $agent = GenerateUserAgent();
  18. $guid = generate_guid();
  19. $device_id = "android-".$guid;
  20. $data ='{"device_id":"'.$device_id.'","guid":"'.$guid.'","username":"'.$usernamemu.'","password":"'.$passwordmu.'","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}';
  21. $sig = GenerateSignature($data);
  22. $data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=4';
  23. $login = SendRequest('accounts/login/', true, $data, $agent, false);
  24. $obj = @json_decode($login[1], true);
  25. $status = $obj['status'];
  26. $pesan = $obj['message'];
  27. $nama = $obj['full_name'];
  28. if ($status == 'fail'){
  29. echo "<b><font color='red'>Invalid Username/Password</font></b>";
  30. } else {
  31. $data = GetPostData($filename);
  32. $post = SendRequest('media/upload/', true, $data, $agent, true);
  33. $obj = @json_decode($post[1], true);
  34. $status = $obj['status'];
  35. if ($status == "fail"){
  36. echo "<b><font color='red'>Failed upload, Try another photo !</font></b>";
  37. } else {
  38. $caption = preg_replace("/\r|\n/", "", $caption);
  39. $media_id = $obj['media_id'];
  40. $device_id = "android-".$guid;
  41. $data = '{"device_id":"'.$device_id.'","guid":"'.$guid.'","media_id":"'.$media_id.'","caption":"'.$caption.'","device_timestamp":"'.time().'","source_type":"5","filter_type":"0","extra":"{}","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}';
  42. $sig = GenerateSignature($data);
  43. $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=4';
  44. // Now, configure the photo
  45. $conf = SendRequest('media/configure/', true, $new_data, $agent, true);
  46. $obj = @json_decode($conf[1], true);
  47. $status = $obj['status'];
  48. $link1 = "https://instagram.com/p/".$obj['media']['code'];
  49. $link = $obj['media']['code'];
  50. if ($status == "fail"){
  51. echo $conf[1];
  52. } else {
  53. mysql_query("INSERT INTO ikiganteng(mediaid, caption, link) VALUES('$mediaid','$caption','$link1')");
  54. echo "<b>[@".$usernamemu."] <font color='green'>Success Upload Photo! Let's check your photo : <a href='https://instagram.com/p/".$link."'k target='_blank'/> Click here </a></font></b>";
  55. }
  56. }
  57. }
  58. }
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement