当前位置: 首页>>代码示例>>PHP>>正文


PHP Sessions::set方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:dareyesm,项目名称:paginadorPHP,代码行数:24,代码来源:users.php

示例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");
                 }
             }
         }
     }
 }
开发者ID:BryanPalacios,项目名称:AppMul_ProyectoF,代码行数:40,代码来源:AddUser.php


注:本文中的Sessions::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。