本文整理匯總了PHP中Utilities::getSession方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utilities::getSession方法的具體用法?PHP Utilities::getSession怎麽用?PHP Utilities::getSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Utilities
的用法示例。
在下文中一共展示了Utilities::getSession方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: userLogged
function userLogged()
{
$app = \Slim\Slim::getInstance();
session_regenerate_id();
if (isset($_SESSION['perfil'])) {
$session = Utilities::getSession();
$action = '';
if ($session['level'] <= 10) {
$app->redirect('/' . $session['username']);
} else {
$app->redirect('/admin/' . $session['username']);
}
}
}
示例2: usersList
public function usersList($username)
{
$session = Utilities::getSession();
$username = strip_tags(htmlspecialchars($username));
$username = filter_var($username, FILTER_SANITIZE_STRING);
if ($session['username'] == $username) {
$users = User::with('perfil', 'level')->where('level_id', '=', 4)->get();
$links = Utilities::getMenu($session);
foreach ($users as $key => $value) {
$action = '/' . $value->perfil->username;
$value->perfil->action = $action;
}
$this->view = new UsersListView($users, $links);
$this->view->display();
} else {
$this->app->redirect($app->urlFor('admin-login'));
}
}
示例3: index
public function index()
{
date_default_timezone_set('America/Mexico_City');
$total_alumnos = 12;
$fecha_actual = date('Y-m-d');
$fecha_actual = date_create($fecha_actual);
$cursos = Curso::where('status', '=', 1)->where('total_alumnos', '<', $total_alumnos)->get();
$lista_cursos = array();
$session = Utilities::getSession();
$links = Utilities::getMenu($session);
foreach ($cursos as $key => $value) {
$fechaInicio = date_create($value->fechaInicio);
$interval = date_diff($fecha_actual, $fechaInicio);
if ($interval->invert == 0 && $interval->d >= 0) {
$value->action = '/suscribirme/' . $value->curso_id;
$lista_cursos[] = $value;
}
}
//Utilities::printData( $lista_cursos );
$this->view = new Index($this->app->urlFor('join'), $lista_cursos, $links);
$this->view->display();
}
示例4: cambiarFotoView
public function cambiarFotoView($params)
{
$usuario_id = strip_tags(htmlspecialchars($params['usuario']));
$usuario_id = intval($usuario_id);
$usuario_id = filter_var($usuario_id, FILTER_VALIDATE_INT);
$error = 0;
if (!$usuario_id || $usuario_id == 0) {
$error = 1;
}
$usuario = Perfil::find($usuario_id);
if (count($usuario) == 0) {
$error = 2;
}
$action = '/usuario/' . $usuario_id . '/foto/';
$session = Utilities::getSession();
$links = Utilities::getMenu($session);
$this->view = new FotoView($action, Utilities::createToken(), $usuario, $links, $error);
$this->view->display();
}
示例5: loginPost
public function loginPost($post)
{
$email = strip_tags(htmlspecialchars($post['email_input_data']));
$password = strip_tags(htmlspecialchars($post['password_input_data']));
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
$email = filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email) {
$this->app->redirect($this->app->urlFor('maestro-login') . '?attempt=1');
}
if (Authentication::Authenticate($email, $password, 100)) {
$session = Utilities::getSession();
$action = '/admin/maestro/' . $session['username'];
$this->app->redirect($action);
} else {
$this->app->redirect($this->app->urlFor('maestro-login') . '?attempt=2');
}
}
示例6: editView
public function editView($params)
{
$curso_id = strip_tags(htmlspecialchars($params['curso']));
$curso_id = intval($curso_id);
$curso_id = filter_var($curso_id, FILTER_VALIDATE_INT);
$attempt = 0;
$session = Utilities::getSession();
$links = Utilities::getMenu($session);
if (isset($params['attempt']) && is_int($params['attempt'])) {
$attempt = strip_tags(htmlspecialchars($params['attempt']));
$attempt = intval($attempt);
$attempt = filter_var($attempt, FILTER_VALIDATE_INT);
}
if (!$curso_id) {
$this->app->redirect($this->app->urlFor('Index'));
}
$curso = Curso::find($curso_id);
if (count($curso) == 0) {
$this->app->redirect($this->app->urlFor('Index'));
}
$action = '/curso/' . $curso->curso_id . '/edit';
$tipo_curso = TipoCurso::all();
$maestros = Maestro::with('perfil')->get();
$this->view = new CursoEditView($links, $curso, $tipo_curso, $maestros, $action, $attempt);
$this->view->display();
//Utilities::printData($maestros);
}