當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sesion::setVariableSession方法代碼示例

本文整理匯總了PHP中Sesion::setVariableSession方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sesion::setVariableSession方法的具體用法?PHP Sesion::setVariableSession怎麽用?PHP Sesion::setVariableSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sesion的用法示例。


在下文中一共展示了Sesion::setVariableSession方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Sesion

<?php

header('Cache-Control: no-cache');
header('Pragma: no-cache');
include "../_util/Sesion.php";
$objSesion = new Sesion();
if (!isset($_SESSION['username']) && !isset($_SESSION['userid'])) {
    header("Location: ../login/logout.php");
}
include "../_util/Datos.php";
$dirses = new Sesion();
$dirses->setVariableSession("dir", "");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>INSERTAR BANNER </title>
        <!-- include para formulario --> 
        
        <script type="text/javascript" src="../js/jquery_1.5.2.js" ></script>
        <script type="text/javascript" src="../js/ajaxupload.3.5.js" ></script>
        <script type="text/javascript" src="../js/uploader3.js" ></script>
        
        <script type="text/javascript" src="../javascripts/jquery.js"></script>
        <script type="text/javascript" src="../javascripts/parsley.js"></script>
        <script type="text/javascript" src="../javascripts/_util.js"></script>
        <link rel="stylesheet" type="text/css" href="../stylesheets/bootstrap.css"/>
        <link rel="stylesheet" type="text/css" href="../stylesheets/forms.css"/>
        <link rel="stylesheet" type="text/css" href="../stylesheets/styles.css" />
        <!-- fin include para formulario -->
開發者ID:dfg510dfg,項目名稱:fvv,代碼行數:31,代碼來源:INSbanner.php

示例2: Sesion

<?php

/********************************************************************************
* This script is brought to you by Vasplus Programming Blog
* Website: www.vasplus.info
* Email: info@vasplus.info
*********************************************************************************/
include "../_util/Sesion.php";
$dirses = new Sesion();
$uploaded_files_location = '../../convocatorias/';
//This is the directory where uploaded files are saved on your server
$final_location = $uploaded_files_location . basename($_FILES['file_to_upload']['name']);
/******************************************************
1.  recuperar el id del banner
2. hacer un selec a la tabla y traer el nombre del banner = ../imgs_banner/foto1.jpg 
3. @unlink($uploaded_files_location);
4. update a la tabla banner  = foto2222.jpg  
******************************************************/
if (move_uploaded_file($_FILES['file_to_upload']['tmp_name'], $final_location)) {
    //Here you can save the uploaded file to your database if you wish before the success message below
    echo "file_uploaded_successfully";
    $dirses->setVariableSession("dir", basename($_FILES['file_to_upload']['name']));
} else {
    echo "file_upload_was_unsuccessful";
}
開發者ID:dfg510dfg,項目名稱:fvv,代碼行數:25,代碼來源:uploader.php

示例3: Sesion

<?php

include "../_util/Sesion.php";
$objSesion = new Sesion();
$username = $objSesion->getVariableSession("username");
$userid = $objSesion->getVariableSession("userid");
if (!isset($username) && !isset($userid)) {
    include "../_util/Mysql.php";
    $objMysql = new Mysql();
    try {
        $sql = "SELECT usuario,clave,idusuario FROM " . DB_PREFIJO . "_usuarios WHERE usuario='" . $_POST['login_username'] . "' && clave='" . md5($_POST['login_userpass']) . "' LIMIT 0,1";
        $rs = $objMysql->ejecutar($sql);
        $num_rows = $rs->rowCount();
        if ($num_rows == 1) {
            $user = $rs->fetch(PDO::FETCH_ASSOC);
            $objSesion->setVariableSession("username", $user['usuario']);
            $objSesion->setVariableSession("userid", $user['idusuario']);
            echo 1;
        } else {
            echo 0;
        }
    } catch (PDOException $exc) {
        print $exc->__toString();
        echo 0;
    }
} else {
    echo 0;
}
開發者ID:dfg510dfg,項目名稱:fvv,代碼行數:28,代碼來源:log.inout.ajax.php


注:本文中的Sesion::setVariableSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。