本文整理汇总了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 -->
示例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";
}
示例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;
}