本文整理汇总了PHP中Sessions::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Sessions::set方法的具体用法?PHP Sessions::set怎么用?PHP Sessions::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sessions
的用法示例。
在下文中一共展示了Sessions::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_in2
public function login_in2($datos = FALSE)
{
$objdata = new Database();
$sth = $objdata->prepare('SELECT * FROM users U inner join profiles P ' . 'ON U.idProf = P.idProfile ' . 'WHERE U.idUser = :id');
$sth->execute(array(':id' => $datos));
$data = $sth->fetch();
$count = $sth->rowCount();
if ($count > 0) {
require 'sessions.php';
$objSess = new Sessions();
$objSess->init();
$objSess->set('login', $data['logUser']);
$objSess->set('idpro', $data['idProf']);
$objSess->set('profi', $data['profName']);
switch ($data['profName']) {
case 'Admin':
header('location: ' . URL . 'admin/');
break;
case 'Standard':
header('location: ' . URL . 'dashboard/');
break;
}
}
}
示例2: add
public function add()
{
$name = $_POST["name"];
$lastname = $_POST["lastname"];
$email = $_POST["email"];
$pass = $_POST["pass"];
$conf = $_POST["conf"];
if ($name == null or $lastname == null or $email == null or $pass == null or $conf == null) {
header("location: Unirse.php?error=1");
} else {
if ($pass != $conf) {
header("location: Unirse.php?error=2");
} else {
$sql = "select * from usuario where Email='" . $email . "'";
$result = $this->cone->procedure($sql);
if ($result) {
if (!$result->fetch_assoc()) {
$sql = "select (count(idUsuario)+1) as 'newId' from usuario";
$result = $this->cone->procedure($sql);
if ($result) {
if ($row = $result->fetch_assoc()) {
$sql = "insert into Usuario values (" . $row['newId'] . ",'" . $name . "','" . $lastname . "','" . $email . "','" . $pass . "',null)";
$rs = $this->cone->procedure($sql);
if ($rs) {
$ses = new Sessions();
$ses->init();
$ses->set("user", $email);
header("location: ../User/index.php");
} else {
header("location: Unirse.php?error=3");
}
}
}
} else {
header("location: Unirse.php?error=4");
}
}
}
}
}