本文整理汇总了PHP中SessionController::set方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionController::set方法的具体用法?PHP SessionController::set怎么用?PHP SessionController::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionController
的用法示例。
在下文中一共展示了SessionController::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseLogin
public static function parseLogin()
{
$email = $_POST['email'];
$senha = $_POST['senha'];
$temp = DBController::init();
$usuarios = $temp->db_user;
$all = iterator_to_array($usuarios->find(["email" => $email, "senha" => $senha]));
if ($all != array()) {
foreach ($all as $key => $value) {
$obj = array('token' => $key, 'nome' => $value['nome'], 'email' => $value['email'], 'senha' => $value['senha'], 'status' => true, 'message' => "Login feito com sucesso");
}
SessionController::set("user", $obj);
} else {
$obj = array('email' => $email, 'senha' => $senha, 'status' => false, 'message' => "Email ou senha incorretos", 'status' => false);
}
RotaController::res($obj);
}
示例2: login
public function login($email = null, $user_password = null)
{
//check if email exists in data base
//check if password is set
if ($this->find_by_email($email) && $user_password) {
$this->_email = $email;
$this->_password = $user_password;
$this->_hash = $this->_data['password'];
if (Encryption::checkPassword($this->_password, $this->_hash)) {
//set the data in a session.
$session = new SessionController();
$session->set('user_session', array("user_id" => $this->_data['id'], "name" => $this->_data['name'] . " " . $this->_data['lastname']));
return true;
// RedirectController::to("/kortingennu/");
}
}
return false;
}