本文整理汇总了PHP中Authenticate::is_valid_token方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticate::is_valid_token方法的具体用法?PHP Authenticate::is_valid_token怎么用?PHP Authenticate::is_valid_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticate
的用法示例。
在下文中一共展示了Authenticate::is_valid_token方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieve_leaderboard
/**
* retrieve player ranking and global ranking.
* route : player
*/
public function retrieve_leaderboard()
{
if (Authenticate::is_player()) {
if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_leaderboard = Leaderboard::getInstance();
$player_ranking = $this->model_leaderboard->get_player_ranking();
$global_ranking = $this->model_leaderboard->get_global_ranking();
$binding = array("result_var" => "session_ready", "leaderboard_player_var" => json_encode($player_ranking), "leaderboard_global_var" => json_encode($global_ranking));
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}
示例2: update_product_price
/**
* update product price.
*
* role: player
*/
public function update_product_price()
{
if (Authenticate::is_player()) {
if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_product = Product::getInstance();
$product = $_POST['product_data'];
$result = $this->model_product->update_player_product($product);
$binding = array("result_var" => "session_ready", "status_var" => $result);
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}
示例3: unlock_achievement
/**
* save new achievement via REST.
* role: player
*/
public function unlock_achievement()
{
if (Authenticate::is_player()) {
if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_achievement = Achievement::getInstance();
/*
* populate type of achievement.
* invoke method to unlock the achievement.
* log this event about achievement earning.
*/
$achievement = $_POST["achievement"];
$result = $this->model_achievement->unlock_achievement($achievement);
$log = Log::getInstance();
$log->logging_game_earn_achievement("Achievement id {$achievement}");
$binding = array("result_var" => "session_ready", "unlock_status" => $result);
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}
示例4: update_employee
/**
* update employee status.
* role: player
*/
public function update_employee()
{
if (Authenticate::is_player()) {
if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_employee = Employee::getInstance();
$employee = $_POST['employee_data'];
$result = $this->model_employee->update_employee_status($employee);
$binding = array("result_var" => "session_ready", "status_var" => $result);
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}
示例5: retrieve_balance
/**
* retrieve balance sheet from database.
* role: player
*/
public function retrieve_balance()
{
if (Authenticate::is_player()) {
if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_journal = Journal::getInstance();
/*
* invoke method to retrieve balance data.
* convert into json format and binding these data.
*/
$result = $this->model_journal->get_balance_sheet();
$binding = array("result_var" => "session_ready", "balance_var" => json_encode($result, JSON_PRETTY_PRINT));
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}
示例6: update_material
/**
* role: player
*/
public function update_material()
{
if (Authenticate::is_player()) {
if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_material = Material::getInstance();
$material = $_POST["material_data"];
$result = true;
foreach (json_decode($material) as $attribute) {
$result = $this->model_material->update_material($attribute->pma_id, $attribute->pma_stock, $attribute->pma_expired_remaining);
}
$binding = array("result_var" => "session_ready", "status_var" => $result);
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}
示例7: get_simulation_avatar
/**
* retrieve another avatar from another user.
* role: player
* @return string
*/
public function get_simulation_avatar()
{
if (Authenticate::is_player()) {
if (true || isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
$this->model_player = Player::getInstance();
/*
* retrieve at least 3 avatar except player.
* wrap it up and convert to json format.
*/
$avatar = $this->model_player->fetch_simulation_avatar();
$binding = array("result_var" => "session_ready", "avatar_var" => json_encode($avatar, JSON_PRETTY_PRINT));
binding_data($binding);
} else {
transport("error404");
}
} else {
$binding = array("result_var" => "no_session");
binding_data($binding);
}
}