我的自定义代码一直工作到昨天。当用户使用facebook注册登录时,它具有到期日期,并且根据到期日期,他被重定向到自定义URL。但现在facebook登录返回登录页面。
<?php
ob_start();
include_once("config.php");
include_once("includes/functions.php");
//destroy facebook session if user clicks reset
if(!$fbuser){
$fbuser = null;
$loginUrl = $facebook->getLoginUrl(array('redirect_uri'=>$homeurl,'scope'=>$fbPermissions));
$output = '<a href="'.$loginUrl.'"><img src="images/fb_login.png"></a>';
}else{
$user_profile = $facebook->api('/me?fields=id,first_name,last_name,email,gender,locale,picture');
$user = new Users();
$user_data = $user->checkUser('facebook',$user_profile['id'],$user_profile['first_name'],$user_profile['last_name'],$user_profile['email'],$user_profile['gender'],$user_profile['locale'],$user_profile['picture']['data']['url'],$user_profile['redirect']);
if(!empty($user_data)){
/*$output = '<h1>Facebook Profile Details </h1>';
$output .= '<img src="'.$user_data['picture'].'">';
$output .= '<br/>Facebook ID : ' . $user_data['oauth_uid'];
$output .= '<br/>Name : ' . $user_data['fname'].' '.$user_data['lname'];
$output .= '<br/>Email : ' . $user_data['email'];
$output .= '<br/>Gender : ' . $user_data['gender'];
$output .= '<br/>Locale : ' . $user_data['locale'];
$output .= '<br/>You are login with : Facebook';
$output .= '<br/>Logout from <a href="logout.php?logout">Facebook</a>'; */
$Expoutput = $user_data['expiredurl'];
$createdOn = $user_data['created'];
$todayDate = date("Y-m-d H:i:s");
$expiredOn = $user_data['expiredon'];
$output = $user_data['redirect'];
}else{
$output = '<h3 style="color:red">Some problem occurred, please try again.</h3>';
}
}
?>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Login with Facebook</title>
<style type="text/css">
h1 {
font-family: Arial, Helvetica, sans-serif;
color: #999999;
}
</style>
<script type="text/javascript" src="inc/jquery.min.js"></script>
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '1748104402093981');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1748104402093981&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
</head>
<body>
<div>
<style>
.facebookVCont {clear: both;
display: block;
margin: 20% auto 0;
width:300px;
max-width: 80%;
overflow: hidden;
text-align: center;}
.facebookVCont a{clear: both;
display: block;
overflow: hidden;
width: 100%;}
.facebookVCont a img{clear: both;
display: block;
overflow: hidden;
width: 100%;}
.facebookVCont p{color: #898989;
font-family: verdana;
font-size: 17px;}
.facebookVCont p img{width: 13px; }
.facebookVCont h4{color: #e31e24;
font-family: verdana;
font-size: 23px;
margin: 0;}
.liti {
height: 2px;
width: 100%;
margin-top:40px;
margin-bottom:40px;
overflow:hidden;
display: block;
background-color: rgba(0,0,0,0.1);
clear: both !important;
}
.bttg{
margin:0 auto;
width:75%;
background-color:#26A65B;
color:white;
display:block;
padding:10px 4px;
text-align:center;
font-family:helvetica;
font-size:18px;
text-decoration:none;
border-radius:7px;
}
</style>
<!--<div class="facebookVCont">
<a href="'.$loginUrl.'"><img src="images/fb-login.png" /></a>
<p><img src="images/lock.png"/> This does not let the app post to Facebook.</p>
<h4 style="font-size:16px;">This App is only for Paid Customers.</h4>
</div>-->
<?php
// echo $output;
if ($output == '<a href="'.$loginUrl.'"><img src="images/fb_login.png"></a>')
{
echo '<div class="facebookVCont"><a href="'.$loginUrl.'"><img src="images/fb-login.png" /></a><p><img src="images/lock.png"/> This does not let the app post to Facebook.</p><h4 style="font-size:16px;">This App is only for Paid Customers.</h4></div>';
}
else{
if ($todayDate > $expiredOn){
//echo '<h1> Expired </h1>';
header('Location: '.$Expoutput);
}
else{
//echo '<h1> Not Expired </h1>';
header('Location: '.$output);
}
}
?>
</div>
<div class="liti"></div>
<p align="center" style="font-family:verdana; margin-top:20px; margin-left:20px;margin-right:20px;font-size:16px;margin-bottom:20px;color:#e31e24;font-weight:bold;">Not a Paid Customer ?</p>
<a class="bttg" href="mobincube://action/browser/http%3A%2F%2Fdemo.experttraining.in%2Fapp">Download Free App</a>
</body>
</html>