Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- session_start();
- $_GET['id']=str_replace("@","",$_GET['id']);
- $getid=addslashes($_GET['id']);
- $gettype=addslashes($_GET['type']);
- if ($gettype=='Load Videos') {
- $vidurl='http://grampics.com/userv/'.$getid;
- header("Location: ".$vidurl."");
- exit;
- }
- $getmaxid=addslashes($_GET['maxid']);
- $getminid=addslashes($_GET['minid']);
- $getusername=addslashes($_GET['id']);
- $sameuser=0;
- if ($_SESSION["username"]==$getusername) {$sameuser=1;}
- $_SESSION["username"] = $getusername;
- $getpreviousmax=$_SESSION["pmax"];
- $_SESSION["pmax"]=$getmaxid;
- $getid=str_replace("@","",$getid);
- $rlistingidurl="http://grampics.com/user/".$getid;
- $rlistingidurl=strtolower($rlistingidurl);
- function curPageURL() {
- $pageURL = 'http';
- if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
- $pageURL .= "://";
- if ($_SERVER["SERVER_PORT"] != "80") {
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
- } else {
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
- }
- return $pageURL;
- }
- $rdurl=curPageURL();
- $url=$rdurl;
- if (false !== strpos($url,'insta.php')) {
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: ".$rlistingidurl."");
- header('content-type: text/html; charset=utf-8');
- exit;
- } else {
- echo '';
- }
- /**/
- ?>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
- <head>
- <?
- header('Content-Type: text/html; charset=utf-8');
- include 'db.php';
- $resultb = mysqli_query($con,"SELECT username, fullname FROM user WHERE username = '".$getusername."'");
- while ($rowb = mysqli_fetch_assoc($resultb))
- {
- if ($rowb['username']!='')
- {
- $atusername='@'.$rowb['username'];
- }
- $fullname=$rowb['fullname'];
- }
- ?>
- <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
- <!--#e9ebee-->
- <style>
- a {text-decoration:none;}
- body {font-family:trebuchet ms;background-color:#f6f7f8;margin:0px;padding:0px;text-align:center;}
- img.lpp {margin:0px 3px;border-radius:150px;max-height:150px;}
- div.lpeeps {width:180px;text-align:center;height:180px;display:inline-block;color:#3d6772;text-decoration:none;font-weight:bold;}
- a.lpeeps {width:180px;text-align:center;height:180px;display:inline-block;color:#3d6772;text-decoration:none;font-weight:bold;}
- a.lpeeps:hover {color:#61a8c1;opacity: 0.5;filter: alpha(opacity=50);}
- table.twrap{width:100%;}
- img.picyo{max-width:280px;}
- a.ggbbn {
- box-shadow: 0px 1px 1px #999999;
- text-decoration: none;
- border-radius: 15px;
- font-weight: bold;
- display: inline-block;
- background: #3897f0;
- color: #ffffff;
- width: 150px;
- padding: 12px 0px;
- text-align: center;
- margin: 10px;
- }
- a.ggbbn:hover {background:#005bb0;}
- /*
- a.ggbbn:active {background:#005bb0;}
- a.ggbbn:visited {background:#005bb0;}
- */
- a.ggbbp {
- box-shadow: 0px 1px 1px #999999;
- text-decoration: none;
- border-radius: 15px;
- font-weight: bold;
- display: inline-block;
- background: #005bb0;
- color: #ffffff;
- width: 150px;
- padding: 12px 0px;
- text-align: center;
- margin: 10px;
- }
- a.ggbbp:hover {background:#3897f0;}
- /*
- a.ggbbp:active {background:#3897f0;}
- a.ggbbp:visited {background:#3897f0;}
- */
- </style>
- <meta name=viewport content="width=device-width, initial-scale=1">
- <?
- if(stristr($_SERVER['HTTP_USER_AGENT'], "Mobile")){ // if mobile browser
- $ismobile='yes';
- ?>
- <style>
- table.twrap{width:98%;}
- </style>
- <?
- }
- else
- {
- $ismobile='no';
- }
- ?>
- <? if ($atusername=='') { $atusername='@'.$_GET['id'];}?>
- <title><? echo $atusername;?> - Top Ranked Instagram Posts</title>
- <meta name="description" content="View highest ranked Instagram posts by <? echo $atusername;?> <? if ($fullname!=''){?>(<? echo ' '.$fullname;?>)<?}?>. View most liked and most commented posts.">
- </head>
- <?
- if ($gettype=='Load Videos') {
- ?>
- <body onload="getresults('<? echo $getusername; ?>')">
- <?
- }
- else
- {
- ?>
- <body>
- <?
- }
- ?>
- <? include 'menu.php'; ?>
- <?
- $privateuser=0;
- $vcount=0;
- $userid=addslashes($_GET['id']);
- $getusername=addslashes($_GET['id']);
- if ($getmaxid=='')
- {
- //$request_url ="https://www.instagram.com/".$userid."/media/";
- $request_url ="https://www.instagram.com/".$userid."/?__a=1";
- //echo '<br><br><br><br><br><br>'.$request_url;
- }
- if ($getmaxid!='')
- {
- $request_url ="https://www.instagram.com/".$userid."/?__a=1&max_id=".$getmaxid;
- //echo '<br><br><br><br><br>'.$request_url;
- }
- //if ($getminid!='')
- //{
- //$request_url ="https://www.instagram.com/".$userid."/media?min_id=".$getminid;
- //}
- //$request_url ="https://www.instagram.com/".$userid."/?__a=1";
- $requests123 = @file_get_contents($request_url);
- $json = json_decode($requests123, true);
- //$valuecount=count($json,1);
- $userid=$json['user']['id'];
- $dbuserid=$json['user']['id'];
- $username=$json['user']['username'];
- $atusername='@'.$username;
- $profilepic=$json['user']['profile_pic_url'];
- $dbprofilepic=$json['user']['profile_pic_url'];
- $maxid=$json['user']['media']['page_info']['end_cursor'];
- $fullname=addslashes($json['user']['full_name']);
- if (is_array($json) || is_object($json))
- { // is array open
- $rowcounter=0;
- foreach ($json['user']['media']['nodes'] as $cv)
- {
- $getthetype=$cv['type'];
- $rowcounter=$rowcounter+1;
- //$postid=$cv['id'];
- //$maxid=$cv['id'];
- if ($rowcounter==1)
- {
- $minid=$cv['id'];
- }
- $getcode=$cv['code'];
- //$fullname=addslashes($cv['user']['full_name']);
- //$username=$cv['user']['username'];
- //$userid=$cv['user']['id'];
- //$atusername='@'.$cv['user']['username'];
- //$username=$cv['user']['username'];
- //$profilepic=$cv['user']['profile_picture'];
- $totalposts=$totalposts+1;
- $thumbnail=$cv['thumbnail_resources'][0]['src'];
- //$picyo=$cv['images']['low_resolution']['url'];
- $picyo=$cv['thumbnail_resources'][3]['src'];
- $datet=date("m/d/Y h:i A", $cv['created_time']);
- if ($rowcounter==1){
- ?>
- <style>
- table.thtn { padding: 10px 0px; width: 320px; text-shadow:1px 2px #ffffff; }
- td.thtnl { width:160px;text-align:center; }
- td.thtnr { text-align:center; }
- </style>
- <? if ($ismobile=='yes') { ?>
- <style>
- td.thtnl{width:320px;text-align:center;}
- td.thtnr{width:320px;text-align:center;}
- </style>
- <? } ?>
- <? include 'peepdeets.php'; ?>
- <br>
- <!---------------- TOP BANNER ------------------------------------------------>
- <?
- if ($ismobile!='yes')
- {
- $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Top' ORDER BY RAND() LIMIT 1");
- }
- if ($ismobile=='yes')
- {
- $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Top Mobile' ORDER BY RAND() LIMIT 1");
- }
- while ($rowp = mysqli_fetch_assoc($resultd))
- {
- $dbcode=$rowp['code'];
- $dbcode = stripslashes($dbcode);
- if ($dbcode!='')
- {
- //echo '<br>';
- echo $dbcode;
- echo '<br>';
- echo '<br>';
- }
- }
- ?>
- <!---------------- TOP BANNER ------------------------------------------------>
- <?
- $sql = "INSERT INTO user (userid, username, fullname, profilepic, private, lastupdate)
- VALUES ('$userid', '$username', '$fullname', '$profilepic', 1, NOW())";
- if (mysqli_query($con, $sql))
- {}
- else
- {
- $sql = "UPDATE user SET fullname='$fullname', profilepic='$profilepic', private=1, lastupdate=NOW() WHERE username='$username'";
- mysqli_query($con, $sql);
- }
- ?>
- <? if ($ismobile=='yes'){$widthp='100%';} else {$widthp='100%';}?>
- <table cellpadding="0" cellspacing="0" style="width:<? echo $widthp;?>;margin:0px 0px 10px 0px;" ><td>
- <?
- }
- ?>
- <a class="op" style="display:inline-block;position:relative;vertical-align:top;margin-bottom:5px;" href="http://grampics.com/post/<? echo $username; ?>/<? echo $getcode; ?>">
- <img style="max-width:320px;" src="<? echo $picyo; ?>" />
- </a>
- <?
- }
- $more=$json['more_available'];
- ?>
- <div style="display:block;margin:0px auto;padding:0px;text-align:center;">
- <?
- if ($getmaxid!='')
- {
- ?>
- <a class="ggbbn" style="cursor:pointer;" onclick="goBack()">Previous Page</a>
- <script>
- function goBack() {
- window.history.back();
- }
- </script>
- <?
- }
- //if ($more==1)
- if ($maxid!='')
- {
- ?><a class="ggbbn" style="width:150px;" href="http://grampics.com/user/<? echo $getusername; ?>&maxid=<? echo $maxid; ?>">Next Page</a><?
- }
- ?>
- </div>
- <?
- }
- ?>
- </td></table>
- <?
- if ($rowcounter==0)
- {//$rowcounter==0
- $privateuser=1;
- $rindb=0;
- $imageexists=0;
- $resultb = mysqli_query($con,"SELECT profilepic FROM user WHERE username = '".$getusername."'");
- while ($rowb = mysqli_fetch_assoc($resultb))
- {
- $ptpp=$rowb['profilepic'];
- $rindb=1;
- $external_link = $ptpp;
- }
- $headers = get_headers($ptpp);
- $scode=substr($headers[0], 9, 3);
- if($scode=='200'){$imageexists=1;}
- if($scode!='200'){$imageexists=0;}
- if ($imageexists=='') {$imageexists=0;}
- if ($imageexists!=0) {$privateimage=$ptpp;}
- if ($imageexists==0)
- {
- libxml_use_internal_errors(true);
- $c = file_get_contents("https://www.instagram.com/$getusername/");
- $d = new DomDocument();
- $d->loadHTML($c);
- $xp = new domxpath($d);
- foreach ($xp->query("//meta[@property='og:image']") as $el)
- {
- $privateimage=$el->getAttribute("content");
- }
- }
- $bigprivateimage=str_replace("s150x150","",$privateimage);
- if ($privateimage!='')
- {
- ?>
- <br><br><br><br>
- <table style="margin:0px auto 20px auto;">
- <tr>
- <td>
- <img style="max-height:150px;border-radius:5px;box-shadow: 0px 1px 7px #000000;" src="<? echo $privateimage; ?>"/>
- </td>
- <? if ($ismobile=='yes'){?></tr><tr><? } ?>
- <td>
- <span style="font-size:28px;font-weight:normal"><? echo $atusername; ?></span>
- <br><span style="font-size:16px;color:#565656;font-weight:normal">(private user)</span>
- </td>
- </tr>
- </table>
- <img style="margin-bottom:5px auto;" src="http://grampics.com/img/private.png" />
- <h3>@<? echo $_GET['id'];?> is a private user</h3>
- <?
- }
- if ($privateimage!='')
- {
- $sql = "UPDATE user SET profilepic='$privateimage', private=2, lastupdate=NOW() WHERE username='$getusername'";
- mysqli_query($con, $sql);
- }
- if ($privateimage=='')
- {
- ?>
- <br><br><br><br><br>
- <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;" />
- <h3>@<? echo $_GET['id'];?> can not currently be located</h3>
- <?
- $sqld = "DELETE FROM user WHERE username='$getusername'";
- mysqli_query($con, $sqld);
- }
- echo '<br><br>';
- }//$rowcounter==0
- ?>
- <? if ($rowcounter>=1) {?>
- <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;" >
- <tr>
- <td style="vertical-align:top;text-align:center;margin:0px auto;padding:5px 0px 0px 0px;background-color:transparent;border-width:0px;">
- <?php
- //$pageurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
- $pageurl = "http://grampics.com/user/".$getusername;
- ?>
- <style>
- img.sharebuttons {opacity: 1;box-shadow:0px 1px 2px #888888;border-radius:100px;}
- img.sharebuttons:hover {opacity: 0.7;}
- a.sharebuttons{margin:4px 6px;padding:0px;display:inline-block;border-width:0px;}
- </style>
- <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>
- <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>
- <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>
- <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>
- </td>
- </tr>
- </table>
- <!---------------- BOTTOM BANNER ------------------------------------------------>
- <?
- if ($ismobile!='yes')
- {
- $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Bottom' ORDER BY RAND() LIMIT 1");
- }
- if ($ismobile=='yes')
- {
- $resultd = mysqli_query($con,"SELECT code FROM adverts WHERE position='Bottom Mobile' ORDER BY RAND() LIMIT 1");
- }
- while ($rowp = mysqli_fetch_assoc($resultd))
- {
- $dbcode=$rowp['code'];
- $dbcode = stripslashes($dbcode);
- if ($dbcode!='')
- {
- echo '<br>';
- echo $dbcode;
- echo '<br>';
- echo '<br>';
- }
- }
- ?>
- <!---------------- BOTTOM BANNER ------------------------------------------------>
- <? } ?>
- <? include 'footer.php'; ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement