我有一个在localhost上运行更好的网站,但是当我上传到在线服务器时,这会显示很多错误,例如:
语法错误,index.php第80行中出现意外的T_PAAMAYIM_NEKUDOTAYIM:
Index.php第80行
// becomes global. can be access on any page
$csrf_token = $csrf :: $token;
Csrf.php
<?php
/**
* Csrf - Cross Site Request Forgery
* @category Security
*/
class Csrf{
public static $token=null;
function __construct(){
$token=get_session('csrf_token');
if(empty($token)){
$token=md5(random_str(12));
set_session('csrf_token',$token); //set new token in session if not available
}
self :: $token=$token;
}
/**
* Csrf - Verify if the request is coming from our origin
* @category Security
*/
public static function cross_check(){
$current_token=get_session('csrf_token');
$req_token = "";
if(!empty($_SERVER['HTTP_X_CSRF_TOKEN'])){
$req_token=$_SERVER['HTTP_X_CSRF_TOKEN'];
}
elseif(!empty($_REQUEST['csrf_token'])){
$req_token=$_REQUEST['csrf_token'];
}
if($req_token != $current_token){
render_error("Cross-Site request Forgery Detected. Please Contact The System Administrator For More Information",403);
exit;
}
return null;
}
}
请帮我解决。谢谢你。