Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('../include/db.php');
- dbConnect();
- include('../include/config.php');
- include('../include/functions.php');
- $today=date("Y-m-d H:i:s");
- var_dump($_SESSION);
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Sportfant Home</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="../css/mainstyle.css" rel="stylesheet" type="text/css">
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
- <script type="text/javascript" src="<?php echo $url; ?>js/functions.js"></script>
- </head>
- <body>
- <?php
- if(strpos(curPageURL(),"checkout")===false)
- $_SESSION['paypal_redirect']=curPageURL();
- if(isset($_GET['paypal_code'])){
- $pcode=mysql_real_escape_string($_GET['paypal_code']);
- $result=mysql_query("select * from orders where code='$pcode' && confirmed=0");
- if(mysql_num_rows($result)>0){
- $payinfo=mysql_fetch_assoc($result);
- mysql_query("update orders set confirmed=1 where id='$payinfo[id]' ");
- mysql_query("update members set balance=balance+$payinfo[quantity] where id='$payinfo[member_id]' ");
- mysql_query("insert into transactions (member_id,description,amount) values ('$payinfo[member_id]','Deposit','$payinfo[quantity]') ");
- }
- }
- if(isset($_SESSION['message'])){
- echo "<div class='bigredbar'>".$_SESSION['message']."</div>";
- unset($_SESSION['message']);
- }
- if(isset($_SESSION[teamstuff])){
- unset($_SESSION[teamstuff]);
- }
- //if referral and user logged in, log them out
- if($_GET['referral'] && $_SESSION[user_id]){
- unset($_SESSION[user_id]);
- unset($_SESSION[username]);
- unset($_SESSION[user_level]);
- }
- $show_miss=0;
- //get visitor's country
- $ip=$_SERVER['REMOTE_ADDR'];
- if(!isset($_SESSION['user_id'])){
- $response=file_get_contents("http://api.ipinfodb.com/v3/ip-city/?key=e4dc977a58bf4974da9ba06f0e8925c00c4506fa1a21fe2c7c45dc839ab24214&ip=".$ip);
- $response_arr=explode(";",$response);
- $usercountry=trim(ucwords(strtolower($response_arr[4]))); //user's country
- $timediff=$response_arr[count($response_arr)-1]; //user's time difference relative to GMT
- $usercity=trim(ucwords(strtolower($response_arr[6]))); //user's city
- if($usercountry=="Russian Federation")
- $usercountry="Russia";
- }
- else{
- //get current account info
- $result=mysql_query("select * from members where id='$_SESSION[user_id]' ");
- $accinfo=mysql_fetch_assoc($result);
- $next=$accinfo['account_type']+1;
- $today=date("Y-m-d");
- $monthago=date("Y-m-d",time()-60*60*24*30);
- $meds=array(1,2,3,4,5,6,7,8,9,10,11);
- //in the sub-arrays, keys are medal IDs and values are numbers of needed medals
- $meds[1]=array(1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,9=>0,10=>0,11=>0);
- $meds[2]=array(1=>1,2=>1,3=>1,4=>1,5=>1,6=>0,7=>0,8=>0,9=>0,10=>0,11=>0);
- $meds[3]=array(1=>3,2=>3,3=>3,4=>3,5=>3,6=>1,7=>0,8=>0,9=>0,10=>0,11=>0);
- $meds[4]=array(1=>5,2=>5,3=>5,4=>5,5=>5,6=>2,7=>1,8=>0,9=>0,10=>0,11=>0);
- $meds[5]=array(1=>7,2=>7,3=>7,4=>7,5=>7,6=>3,7=>2,8=>1,9=>0,10=>0,11=>0);
- $meds[6]=array(1=>10,2=>9,3=>9,4=>9,5=>9,6=>5,7=>3,8=>2,9=>0,10=>0,11=>0);
- $meds[7]=array(1=>13,2=>12,3=>12,4=>12,5=>12,6=>6,7=>4,8=>2,9=>1,10=>0,11=>0);
- $meds[8]=array(1=>17,2=>15,3=>15,4=>15,5=>15,6=>8,7=>5,8=>3,9=>2,10=>0,11=>0);
- $meds[9]=array(1=>19,2=>17,3=>17,4=>17,5=>17,6=>8,7=>6,8=>4,9=>3,10=>1,11=>0);
- $meds[10]=array(1=>21,2=>19,3=>19,4=>19,5=>19,6=>8,7=>6,8=>4,9=>3,10=>2,11=>1);
- $meds[11]=array(1=>21,2=>19,3=>19,4=>19,5=>19,6=>9,7=>7,8=>5,9=>4,10=>2,11=>2);
- $missing=0;
- foreach($meds[$next] as $medal_id => $num){
- $result=mysql_query("select * from medals_awarded where member_id='$_SESSION[user_id]' && medal_id='$medal_id' && type='gold' order by date_time desc ");
- $row=mysql_fetch_assoc($result);
- $prev=mysql_num_rows($result); //medals of this kind won up to this day
- $total=$meds[$next][$medal_id]-$meds[$level][$medal_id]; //total spaces in the medal holder
- $full=$prev-$meds[$level][$medal_id];
- if($full>$total)
- $full=$total;
- if($full<0)
- $full=0;
- $missing=$missing+$total-$full;
- }
- //$missing is the number of missing medals
- //if $missing is less than 3 and we're either on our office page or we haven't shown the popup for this level yet, show the popup
- if($missing<3 && ($accinfo['medal_popup']<$accinfo['account_type'] || strpos(curPageURL(),"office.php")!==false)){
- $show_miss=1;
- mysql_query("update members set medal_popup=account_type where id='$_SESSION[user_id]' ");
- }
- }
- ?>
- <!-- page HTML -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment