Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.76 KB | None | 0 0
  1. <?
  2. session_start();
  3.  
  4. $_GET['id']=str_replace("@","",$_GET['id']);
  5. $getid=addslashes($_GET['id']);
  6.  
  7. $gettype=addslashes($_GET['type']);
  8.  
  9.  
  10. if ($gettype=='Load Videos') {
  11.  
  12. $vidurl='http://grampics.com/userv/'.$getid;
  13. header("Location: ".$vidurl."");
  14.  
  15. exit;
  16. }
  17.  
  18.  
  19. $getmaxid=addslashes($_GET['maxid']);
  20. $getminid=addslashes($_GET['minid']);
  21. $getusername=addslashes($_GET['id']);
  22. $sameuser=0;
  23. if ($_SESSION["username"]==$getusername) {$sameuser=1;}
  24. $_SESSION["username"] = $getusername;
  25.  
  26. $getpreviousmax=$_SESSION["pmax"];
  27. $_SESSION["pmax"]=$getmaxid;
  28.  
  29. $getid=str_replace("@","",$getid);
  30.  
  31. $rlistingidurl="http://grampics.com/user/".$getid;
  32. $rlistingidurl=strtolower($rlistingidurl);
  33. function curPageURL() {
  34. $pageURL = 'http';
  35. if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  36. $pageURL .= "://";
  37. if ($_SERVER["SERVER_PORT"] != "80") {
  38. $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  39. } else {
  40. $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  41. }
  42. return $pageURL;
  43. }
  44. $rdurl=curPageURL();
  45. $url=$rdurl;
  46. if (false !== strpos($url,'insta.php')) {
  47. header("HTTP/1.1 301 Moved Permanently");
  48. header("Location: ".$rlistingidurl."");
  49. header('content-type: text/html; charset=utf-8');
  50. exit;
  51. } else {
  52. echo '';
  53. }
  54. /**/
  55. ?>
  56. <!DOCTYPE html>
  57. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  58. <head>
  59. <?
  60. header('Content-Type: text/html; charset=utf-8');
  61. include 'db.php';
  62.  
  63. $resultb = mysqli_query($con,"SELECT username, fullname FROM user WHERE username = '".$getusername."'");
  64. while ($rowb = mysqli_fetch_assoc($resultb))
  65. {
  66. if ($rowb['username']!='')
  67. {
  68. $atusername='@'.$rowb['username'];
  69. }
  70. $fullname=$rowb['fullname'];
  71. }
  72. ?>
  73. <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
  74. <!--#e9ebee-->
  75. <style>
  76. a {text-decoration:none;}
  77. body {font-family:trebuchet ms;background-color:#f6f7f8;margin:0px;padding:0px;text-align:center;}
  78. img.lpp {margin:0px 3px;border-radius:150px;max-height:150px;}
  79. div.lpeeps {width:180px;text-align:center;height:180px;display:inline-block;color:#3d6772;text-decoration:none;font-weight:bold;}
  80. a.lpeeps {width:180px;text-align:center;height:180px;display:inline-block;color:#3d6772;text-decoration:none;font-weight:bold;}
  81. a.lpeeps:hover {color:#61a8c1;opacity: 0.5;filter: alpha(opacity=50);}
  82. table.twrap{width:100%;}
  83. img.picyo{max-width:280px;}
  84. a.ggbbn {
  85. box-shadow: 0px 1px 1px #999999;
  86. text-decoration: none;
  87. border-radius: 15px;
  88. font-weight: bold;
  89. display: inline-block;
  90. background: #3897f0;
  91. color: #ffffff;
  92. width: 150px;
  93. padding: 12px 0px;
  94. text-align: center;
  95. margin: 10px;
  96. }
  97. a.ggbbn:hover {background:#005bb0;}
  98. /*
  99. a.ggbbn:active {background:#005bb0;}
  100. a.ggbbn:visited {background:#005bb0;}
  101. */
  102. a.ggbbp {
  103. box-shadow: 0px 1px 1px #999999;
  104. text-decoration: none;
  105. border-radius: 15px;
  106. font-weight: bold;
  107. display: inline-block;
  108. background: #005bb0;
  109. color: #ffffff;
  110. width: 150px;
  111. padding: 12px 0px;
  112. text-align: center;
  113. margin: 10px;
  114. }
  115. a.ggbbp:hover {background:#3897f0;}
  116. /*
  117. a.ggbbp:active {background:#3897f0;}
  118. a.ggbbp:visited {background:#3897f0;}
  119. */
  120. </style>
  121. <meta name=viewport content="width=device-width, initial-scale=1">
  122. <?
  123. if(stristr($_SERVER['HTTP_USER_AGENT'], "Mobile")){ // if mobile browser
  124. $ismobile='yes';
  125. ?>
  126.  
  127. <style>
  128. table.twrap{width:98%;}
  129. </style>
  130. <?
  131. }
  132. else
  133. {
  134. $ismobile='no';
  135. }
  136. ?>
  137. <? if ($atusername=='') { $atusername='@'.$_GET['id'];}?>
  138. <title><? echo $atusername;?> - Top Ranked Instagram Posts</title>
  139. <meta name="description" content="View highest ranked Instagram posts by <? echo $atusername;?> <? if ($fullname!=''){?>(<? echo ' '.$fullname;?>)<?}?>. View most liked and most commented posts.">
  140. </head>
  141. <?
  142. if ($gettype=='Load Videos') {
  143. ?>
  144. <body onload="getresults('<? echo $getusername; ?>')">
  145. <?
  146. }
  147. else
  148. {
  149. ?>
  150. <body>
  151. <?
  152. }
  153. ?>
  154.  
  155. <? include 'menu.php'; ?>
  156.  
  157. <?
  158. $privateuser=0;
  159. $vcount=0;
  160. $userid=addslashes($_GET['id']);
  161. $getusername=addslashes($_GET['id']);
  162. if ($getmaxid=='')
  163. {
  164. //$request_url ="https://www.instagram.com/".$userid."/media/";
  165.  
  166. $request_url ="https://www.instagram.com/".$userid."/?__a=1";
  167. //echo '<br><br><br><br><br><br>'.$request_url;
  168. }
  169. if ($getmaxid!='')
  170. {
  171. $request_url ="https://www.instagram.com/".$userid."/?__a=1&max_id=".$getmaxid;
  172. //echo '<br><br><br><br><br>'.$request_url;
  173. }
  174. //if ($getminid!='')
  175. //{
  176. //$request_url ="https://www.instagram.com/".$userid."/media?min_id=".$getminid;
  177. //}
  178.  
  179.  
  180. //$request_url ="https://www.instagram.com/".$userid."/?__a=1";
  181. $requests123 = @file_get_contents($request_url);
  182. $json = json_decode($requests123, true);
  183. //$valuecount=count($json,1);
  184.  
  185.  
  186. $userid=$json['user']['id'];
  187. $dbuserid=$json['user']['id'];
  188. $username=$json['user']['username'];
  189. $atusername='@'.$username;
  190. $profilepic=$json['user']['profile_pic_url'];
  191. $dbprofilepic=$json['user']['profile_pic_url'];
  192. $maxid=$json['user']['media']['page_info']['end_cursor'];
  193. $fullname=addslashes($json['user']['full_name']);
  194. if (is_array($json) || is_object($json))
  195. { // is array open
  196. $rowcounter=0;
  197. foreach ($json['user']['media']['nodes'] as $cv)
  198. {
  199. $getthetype=$cv['type'];
  200. $rowcounter=$rowcounter+1;
  201. //$postid=$cv['id'];
  202. //$maxid=$cv['id'];
  203. if ($rowcounter==1)
  204. {
  205. $minid=$cv['id'];
  206. }
  207. $getcode=$cv['code'];
  208. //$fullname=addslashes($cv['user']['full_name']);
  209. //$username=$cv['user']['username'];
  210. //$userid=$cv['user']['id'];
  211. //$atusername='@'.$cv['user']['username'];
  212. //$username=$cv['user']['username'];
  213. //$profilepic=$cv['user']['profile_picture'];
  214. $totalposts=$totalposts+1;
  215. $thumbnail=$cv['thumbnail_resources'][0]['src'];
  216. //$picyo=$cv['images']['low_resolution']['url'];
  217. $picyo=$cv['thumbnail_resources'][3]['src'];
  218. $datet=date("m/d/Y h:i A", $cv['created_time']);
  219. if ($rowcounter==1){
  220.  
  221.  
  222. ?>
  223. <style>
  224. table.thtn { padding: 10px 0px; width: 320px; text-shadow:1px 2px #ffffff; }
  225. td.thtnl { width:160px;text-align:center; }
  226. td.thtnr { text-align:center; }
  227. </style>
  228. <? if ($ismobile=='yes') { ?>
  229. <style>
  230. td.thtnl{width:320px;text-align:center;}
  231. td.thtnr{width:320px;text-align:center;}
  232. </style>
  233. <? } ?>
  234. <? include 'peepdeets.php'; ?>
  235.  
  236. <br>
  237. <!---------------- TOP BANNER ------------------------------------------------>
  238. <?
  239.  
  240. if ($ismobile!='yes')
  241. {
  242. $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Top' ORDER BY RAND() LIMIT 1");
  243. }
  244. if ($ismobile=='yes')
  245. {
  246. $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Top Mobile' ORDER BY RAND() LIMIT 1");
  247. }
  248. while ($rowp = mysqli_fetch_assoc($resultd))
  249. {
  250. $dbcode=$rowp['code'];
  251. $dbcode = stripslashes($dbcode);
  252. if ($dbcode!='')
  253. {
  254. //echo '<br>';
  255. echo $dbcode;
  256. echo '<br>';
  257. echo '<br>';
  258. }
  259. }
  260. ?>
  261. <!---------------- TOP BANNER ------------------------------------------------>
  262. <?
  263. $sql = "INSERT INTO user (userid, username, fullname, profilepic, private, lastupdate)
  264. VALUES ('$userid', '$username', '$fullname', '$profilepic', 1, NOW())";
  265. if (mysqli_query($con, $sql))
  266. {}
  267. else
  268. {
  269. $sql = "UPDATE user SET fullname='$fullname', profilepic='$profilepic', private=1, lastupdate=NOW() WHERE username='$username'";
  270. mysqli_query($con, $sql);
  271. }
  272.  
  273. ?>
  274. <? if ($ismobile=='yes'){$widthp='100%';} else {$widthp='100%';}?>
  275. <table cellpadding="0" cellspacing="0" style="width:<? echo $widthp;?>;margin:0px 0px 10px 0px;" ><td>
  276. <?
  277. }
  278. ?>
  279. <a class="op" style="display:inline-block;position:relative;vertical-align:top;margin-bottom:5px;" href="http://grampics.com/post/<? echo $username; ?>/<? echo $getcode; ?>">
  280. <img style="max-width:320px;" src="<? echo $picyo; ?>" />
  281. </a>
  282. <?
  283. }
  284. $more=$json['more_available'];
  285. ?>
  286. <div style="display:block;margin:0px auto;padding:0px;text-align:center;">
  287. <?
  288. if ($getmaxid!='')
  289. {
  290. ?>
  291. <a class="ggbbn" style="cursor:pointer;" onclick="goBack()">Previous Page</a>
  292. <script>
  293. function goBack() {
  294. window.history.back();
  295. }
  296. </script>
  297. <?
  298. }
  299. //if ($more==1)
  300. if ($maxid!='')
  301. {
  302. ?><a class="ggbbn" style="width:150px;" href="http://grampics.com/user/<? echo $getusername; ?>&maxid=<? echo $maxid; ?>">Next Page</a><?
  303. }
  304. ?>
  305. </div>
  306. <?
  307. }
  308. ?>
  309. </td></table>
  310. <?
  311. if ($rowcounter==0)
  312. {//$rowcounter==0
  313. $privateuser=1;
  314. $rindb=0;
  315. $imageexists=0;
  316. $resultb = mysqli_query($con,"SELECT profilepic FROM user WHERE username = '".$getusername."'");
  317. while ($rowb = mysqli_fetch_assoc($resultb))
  318. {
  319. $ptpp=$rowb['profilepic'];
  320. $rindb=1;
  321. $external_link = $ptpp;
  322. }
  323. $headers = get_headers($ptpp);
  324. $scode=substr($headers[0], 9, 3);
  325. if($scode=='200'){$imageexists=1;}
  326. if($scode!='200'){$imageexists=0;}
  327. if ($imageexists=='') {$imageexists=0;}
  328. if ($imageexists!=0) {$privateimage=$ptpp;}
  329. if ($imageexists==0)
  330. {
  331. libxml_use_internal_errors(true);
  332. $c = file_get_contents("https://www.instagram.com/$getusername/");
  333. $d = new DomDocument();
  334. $d->loadHTML($c);
  335. $xp = new domxpath($d);
  336. foreach ($xp->query("//meta[@property='og:image']") as $el)
  337. {
  338. $privateimage=$el->getAttribute("content");
  339. }
  340. }
  341. $bigprivateimage=str_replace("s150x150","",$privateimage);
  342. if ($privateimage!='')
  343. {
  344. ?>
  345. <br><br><br><br>
  346. <table style="margin:0px auto 20px auto;">
  347. <tr>
  348. <td>
  349. <img style="max-height:150px;border-radius:5px;box-shadow: 0px 1px 7px #000000;" src="<? echo $privateimage; ?>"/>
  350. </td>
  351. <? if ($ismobile=='yes'){?></tr><tr><? } ?>
  352. <td>
  353. <span style="font-size:28px;font-weight:normal"><? echo $atusername; ?></span>
  354. <br><span style="font-size:16px;color:#565656;font-weight:normal">(private user)</span>
  355. </td>
  356. </tr>
  357. </table>
  358. <img style="margin-bottom:5px auto;" src="http://grampics.com/img/private.png" />
  359. <h3>@<? echo $_GET['id'];?> is a private user</h3>
  360. <?
  361. }
  362. if ($privateimage!='')
  363. {
  364. $sql = "UPDATE user SET profilepic='$privateimage', private=2, lastupdate=NOW() WHERE username='$getusername'";
  365. mysqli_query($con, $sql);
  366. }
  367. if ($privateimage=='')
  368. {
  369. ?>
  370. <br><br><br><br><br>
  371. <img src="http://grampics.com/img/ph.png" style="border-radius:360px;box-shadow: 0px 1px 5px #888888;margin:0px auto;max-height:150px;max-width:250px;" />
  372. <h3>@<? echo $_GET['id'];?> can not currently be located</h3>
  373. <?
  374. $sqld = "DELETE FROM user WHERE username='$getusername'";
  375. mysqli_query($con, $sqld);
  376. }
  377. echo '<br><br>';
  378. }//$rowcounter==0
  379. ?>
  380. <? if ($rowcounter>=1) {?>
  381. <table border="0" width="98%" cellpadding="0" cellspacing="0" class="tablea" style="width:98%;max-width:650px;margin:0px auto 0px auto;padding:0px;vertical-align:middle;border-radius:3px;" >
  382. <tr>
  383. <td style="vertical-align:top;text-align:center;margin:0px auto;padding:5px 0px 0px 0px;background-color:transparent;border-width:0px;">
  384. <?php
  385. //$pageurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  386. $pageurl = "http://grampics.com/user/".$getusername;
  387.  
  388. ?>
  389. <style>
  390. img.sharebuttons {opacity: 1;box-shadow:0px 1px 2px #888888;border-radius:100px;}
  391. img.sharebuttons:hover {opacity: 0.7;}
  392. a.sharebuttons{margin:4px 6px;padding:0px;display:inline-block;border-width:0px;}
  393. </style>
  394.  
  395.  
  396. <a target="_blank" class="sharebuttons" style="background-color:#f6f7f8;" href="https://www.facebook.com/sharer.php?u=<?php echo $pageurl; ?>" title="Share on Facebook"><img class="sharebuttons" src="http://grampics.com/img/f.png" height="50px" /> </a>
  397. <a target="_blank" class="sharebuttons" style="background-color:#f6f7f8;" href="https://twitter.com/intent/tweet?url=<?php echo $pageurl; ?>&text=<?php echo $pagetitle; ?>" title="Tweet this page"><img class="sharebuttons" src="http://grampics.com/img/t.png" height="50px" /></a>
  398. <a target="_blank" class="sharebuttons" style="background-color:#f6f7f8;" href="https://plus.google.com/share?url=<?php echo $pageurl; ?>" title="Share on Google+"><img class="sharebuttons" src="http://grampics.com/img/goo.png" height="50px" /></a>
  399. <a href="mailto:?subject=<?echo $emailbody?>&body=<?echo $emailbody?> <?php echo $pageurl; ?>" class="sharebuttons" style="background-color:#f6f7f8;" href="" title="email a friend"><img class="sharebuttons" src="http://grampics.com/img/e.png" height="50px" /> </a>
  400.  
  401.  
  402. </td>
  403.  
  404. </tr>
  405. </table>
  406.  
  407.  
  408.  
  409.  
  410. <!---------------- BOTTOM BANNER ------------------------------------------------>
  411. <?
  412.  
  413. if ($ismobile!='yes')
  414. {
  415. $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Bottom' ORDER BY RAND() LIMIT 1");
  416. }
  417. if ($ismobile=='yes')
  418. {
  419. $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Bottom Mobile' ORDER BY RAND() LIMIT 1");
  420. }
  421. while ($rowp = mysqli_fetch_assoc($resultd))
  422. {
  423. $dbcode=$rowp['code'];
  424. $dbcode = stripslashes($dbcode);
  425. if ($dbcode!='')
  426. {
  427. echo '<br>';
  428. echo $dbcode;
  429. echo '<br>';
  430. echo '<br>';
  431. }
  432. }
  433. ?>
  434. <!---------------- BOTTOM BANNER ------------------------------------------------>
  435. <? } ?>
  436. <? include 'footer.php'; ?>
  437. </body>
  438. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement