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


PHP Sessions::init方法代码示例

本文整理汇总了PHP中Sessions::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Sessions::init方法的具体用法?PHP Sessions::init怎么用?PHP Sessions::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sessions的用法示例。


在下文中一共展示了Sessions::init方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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

示例3: mostrarReferencia

<?php

include "../../../../bdConnection.php";
require '../extras/class/sessions.php';
$objses = new Sessions();
$objses->init();
$user = isset($_SESSION['user']) ? $_SESSION['user'] : null;
$sql = "SELECT Type FROM user, role WHERE user.Name = '{$user}' AND user.Role = role.Type";
$cs = mysql_query($sql, $cn);
while ($resul = mysql_fetch_array($cs)) {
    $consul1 = $resul[0];
}
$sql1 = "SELECT lab.id_lab FROM user,lab WHERE user.Name ='{$user}' AND user.lab=lab.id_lab";
$cs1 = mysql_query($sql1, $cn);
while ($resul = mysql_fetch_array($cs1)) {
    $consul2 = $resul[0];
}
?>

<script type="text/javascript">
    
 
 
 <!--
function mostrarReferencia(){
//Si la opcion con id Conocido_1 (dentro del documento > formulario con name fcontacto >     y a la vez dentro del array de Conocido) esta activada
if (document.frm_per.nom_per[4].checked == true) {
//muestra (cambiando la propiedad display del estilo) el div con id 'desdeotro'
document.getElementById('desdeotro').style.display='block';
//por el contrario, si no esta seleccionada
} else {
开发者ID:josecabellozavala,项目名称:Cinvestrain,代码行数:31,代码来源:ajax_form_agregar.php

示例4: Sessions

<?php

require "Sessions.php";
$ses = new Sessions();
$ses->init();
$user = isset($_SESSION['user']) ? $_SESSION['user'] : null;
if ($user != null) {
    $ses->destroy();
    header("location: ../Index.php");
}
开发者ID:BryanPalacios,项目名称:AppMul_ProyectoF,代码行数:10,代码来源:Salir.php

示例5: Sessions

<?php

//llamamos la constante URL
require '../util/constants.php';
//controlamos que se haya iniciado session.
require '../class/sessions.php';
$objSes = new Sessions();
$objSes->init();
$profile = $objSes->get('profi');
if (!isset($profile) && $profile != 'Admin') {
    header('location: ' . URL);
}
if (isset($_POST['nombre'])) {
    require '../class/books.php';
    $objBook = new Books();
    $objBook->insert_book();
} else {
    header('location: ' . URL . 'admin/');
}
开发者ID:dareyesm,项目名称:paginadorPHP,代码行数:19,代码来源:newB_exe.php

示例6: init

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
class Sessions
{
    public static function init($ini_tweaks = true)
    {
        ////
        // Execute ini tweaks for sessions
        ////
        if ($ini_tweaks) {
            ini_set('session.cookie_lifetime', 0);
            ini_set('session.gc_probability', 1);
            ini_set('session.gc_divisor', 100);
            ////
            // Use SHA-1
            ////
            ini_set('hash_function', 1);
            ////
            // 1 Hour
            ////
            ini_set('session.gc_maxlifetime', 3600);
        }
        session_start();
    }
}
Sessions::init();
开发者ID:tsing,项目名称:commando,代码行数:30,代码来源:Sessions.php


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