add urlsafe_base64
This commit is contained in:
parent
2b5584b223
commit
0d266437be
@ -1,28 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
function urlsafe_base64_encode($url){
|
||||||
|
return strtr( base64_encode( $url ) , '+/', '-_' );
|
||||||
|
}
|
||||||
|
function urlsafe_base64_decode($url){
|
||||||
|
return base64_decode(strtr( $url , '-_','+/' ));
|
||||||
|
}
|
||||||
function checkLogin(){
|
function checkLogin(){
|
||||||
if( !isLogin() ){
|
if( !isLogin() ){
|
||||||
$back = $_SERVER['REQUEST_URI']?:'/';
|
|
||||||
if( v('ajax') && isset( $_SERVER['HTTP_REFERER'])&&$_SERVER['HTTP_REFERER'] ){
|
|
||||||
$back = $_SERVER['HTTP_REFERER'];
|
|
||||||
}
|
|
||||||
$state = NULL;
|
|
||||||
if( IFCookie::isNeedFix() ){
|
|
||||||
$sid = session_id();
|
|
||||||
$state = $sid;
|
|
||||||
$back .= '&'.IFCookie::SESSIONSTR.'='.$sid;
|
|
||||||
}
|
|
||||||
$_SESSION['backUrl'] = $back;
|
$_SESSION['backUrl'] = $back;
|
||||||
$aurl = Weibo::getAuthorizeURL( c('callback') , 'code' , $state );
|
$aurl = Weibo::getAuthorizeURL( c('callback') , 'code' );
|
||||||
header("Location: ".$aurl);
|
header("Location: ".$aurl);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function isLogin(){
|
function isLogin(){
|
||||||
if( isset( $_GET['viewer'] ) ){
|
|
||||||
if( $_GET['viewer'] == '' || $_GET['viewer'] != $_SESSION['id'] ){
|
|
||||||
$_SESSION = array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( $_SESSION['id'] ){
|
if( $_SESSION['id'] ){
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
@ -16,6 +16,5 @@ if(is_file(ROOT.'themes/default/'. $__showPage .'.tpl.html'))
|
|||||||
echo "<div>can't find $__showPage html file</div>";
|
echo "<div>can't find $__showPage html file</div>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" charset="utf-8" src="http://js.t.sinajs.cn/t4/enterprise/js/public/appframe/client.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user