Advertisement
Guest User

Untitled

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