本文整理汇总了PHP中session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP session::get方法的具体用法?PHP session::get怎么用?PHP session::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->session->has('lastActivityTime')) {
$this->session->put('lastActivityTime', time());
} else {
if (time() - $this->session->get('lastActivityTime') > $this->getTimeOut()) {
$this->session->forget('lastActivityTime');
Auth::logout();
return redirect($this->getRedirectUrl())->with([$this->getSessionLabel() => 'You have been inactive for ' . $this->timeout / 60 . ' minutes ago.']);
}
}
$this->session->put('lastActivityTime', time());
return $next($request);
}
示例2: notify
/**
* Methode qui va notifier une action
* Arguments:
* + $id: l'id de mon objet
* + $message: le message de notre notification
* + $nature: product | cms | categorie
* + $criticity: success - danger - warning - info
* nature: 0 mon compte, 1 product , 2 categories, 3 cms, 4 fournisseurs
*/
public function notify($id, $message, $nature = 'product', $criticity = "success")
{
// 1. Nous récupérons dans une variable $tabsession
// le tableau de notifications par sa nature
// $this->session->get('nature') permet de récupérer une information par sa clef
// le 2eme argument a la fonction get() permet d'initialiser un tableau vide
// si ma clefs en session n'existe pas
$tabsession = $this->session->get($nature, array());
// 2. Nous stockons dans ce tableau
// la notification avec un message, avec une criticité et une date
$tabsession[$id] = array('message' => $message, 'criticity' => $criticity, 'date' => new \DateTime("now"));
// 3. nous enregistrons le tableau des notifications en session
$this->session->set($nature, $tabsession);
}
示例3: session
function user_cpl()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['user_cp_header'];
if (!isset($_COOKIE['atsphp_sid_user_cp'])) {
$this->login();
} else {
require_once "{$CONF['path']}/sources/misc/session.php";
$session = new session();
list($type, $data) = $session->get($_COOKIE['atsphp_sid_user_cp']);
$TMPL['username'] = $DB->escape($data);
if ($type == 'user_cp') {
$session->update($_COOKIE['atsphp_sid_user_cp']);
// Array containing the valid .php files from the sources/user_cp directory
$action = array('edit' => 1, 'link_code' => 1);
if (isset($FORM['b']) && isset($action[$FORM['b']])) {
$page_name = $FORM['b'];
require_once "{$CONF['path']}/sources/user_cp/{$page_name}.php";
$page = new $page_name();
$TMPL['content'] = $this->do_skin('user_cp');
} elseif (isset($FORM['b']) && $FORM['b'] == 'logout') {
$this->logout();
} else {
$this->main();
}
} else {
$this->login();
}
}
}
示例4: edit_quote
function edit_quote($id, $date, $montant, $pj)
{
global $db;
$date = date('Y-m-d-', strtotime($date));
$values["datinsert"] = MySQL::SQLValue($date);
$values["montant"] = MySQL::SQLValue($montant);
$where["id"] = MySQL::SQLValue($id);
if (!$db->UpdateRows("quotpatronal", $values, $where)) {
$db->Kill($db->Error());
return false;
} else {
$sql = $db->BuildSQLInsert("quotpatronal", $values);
logg('Enregistrement Quote Part Patronal ', 175, $id, $_SESSION['userid']);
if ($pj != "") {
$basedir = "upload/quotpatronal";
if (!file_exists($basedir)) {
mkdir($basedir, 0, true);
}
$newdir = $basedir . "/";
copyfile($pj, $id, $newdir, "Attachement_quotpatronal_");
autoarchive($newdir . changnom($pj, $id, 'Attachement_quotpatronal_'), "Fichier joint Quote Part Patronal {$id}", 175, $id, "quotpatronal", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
}
return true;
}
}
示例5: show
function show($id, $text = "")
{
if (!session::get("tooltips")) {
// display text from database
if ($id) {
$helpArray = fetch_to_array(database::query("SELECT * FROM system WHERE name='{$id}'"), "");
if ($helpArray) {
$entry = current($helpArray);
}
$right = right::get_field($id);
$user = right::get("rights");
$temp = $entry[text];
// admin informations
if (right::superuser()) {
$temp .= "<hr><table>";
$temp .= "<tr><td>fieldname</td><td>{$id}</td></tr>";
// fieldname
$temp .= "<tr><td>edit</td><td>" . right::int2string($right[edit]) . "</td></tr>";
// edit rights
$temp .= "<tr><td>view</td><td>" . right::int2string($right[view]) . "</td></tr>";
// view rights
$temp .= "</table>";
$clickEvent = " onmousedown = edit("{$id}")";
}
if ($text) {
$temp .= "<hr>{$text}";
}
return "onmouseover='return overlib("" . $temp . "");' onmouseout='return nd()' {$clickEvent}";
}
// display special text
}
}
示例6: addStepOne
public function addStepOne()
{
$data = array();
$data['boat_name'] = $_POST['headline'];
$data['boat_type'] = $_POST['boat_type'];
$data['construction_year'] = $_POST['year'];
$data['ce_category'] = $_POST['boat_category'];
$data['yard'] = $_POST['boat_yard'];
$data['boat_model'] = $_POST['boat_model'];
$data['latitude'] = $_POST['latitude'];
$data['longitude'] = $_POST['longitude'];
$data['length'] = $_POST['length'];
$data['width'] = $_POST['width'];
$data['clearance'] = $_POST['clearance'];
$data['draft'] = $_POST['draft'];
$data['weight'] = $_POST['weight'];
$data['passengers'] = $_POST['passengers'];
$data['cabins'] = $_POST['cabins'];
$data['berth'] = $_POST['berth'];
$data['deck_color'] = $_POST['deck_color'];
$data['hull_color'] = $_POST['hull_color'];
$data['deck_mat'] = $_POST['deck_mat'];
$data['hull_mat'] = $_POST['hull_mat'];
$data['type'] = $_POST['featured_status'];
$data['userid'] = session::get('userId');
// $data['title'] = $_POST['headline'];
// $data['city'] = $_POST['city'];
// $data['country'] = $_POST['country'];
// $data['telec'] = $_POST['telecomute'];
// $data['type'] = $_POST['featured_status'];
// $data['userid'] = session::get('userId');
return $this->model->addStepOne($data);
}
示例7: editreform
function editreform($nextid, $titre, $desc, $montant, $pj, $date)
{
global $db;
$usrid = $_SESSION['userid'];
$date_operation = date('Y-m-d-', strtotime($date));
$values["titre"] = MySQL::SQLValue($titre);
$values["description"] = MySQL::SQLValue($desc);
$values["montant"] = MySQL::SQLValue($montant);
$values["date_operation"] = MySQL::SQLValue($date_operation);
$where["id"] = MySQL::SQLValue($nextid);
if (!$db->UpdateRows("produit_reform", $values, $where)) {
$db->Kill($db->Error());
return false;
} else {
$sql = $db->BuildSQLInsert("produit_reform", $values);
logg('Enregistrement Produit Reform ', 167, $nextid, $_SESSION['userid']);
if ($pj != "") {
$basedir = "upload/produit";
if (!file_exists($basedir)) {
mkdir($basedir, 0, true);
}
$newdir = $basedir . "/";
copyfile($pj, $nextid, $newdir, "Attachement_produit_reform");
autoarchive($newdir . changnom($pj, $nextid, 'Attachement_produit_reform'), "Fichier joint produit Reform {$nextid}", 100, $nextid, "produit_reform", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
}
return true;
}
}
示例8: render_file_select
function render_file_select()
{
$id = $this->get_attribute('id');
$md5id = substr(md5($id), 0, 5);
$file_node_id = $this->get_value();
if ($file_node_id && ($file_data = fetch_one_by_node_id($file_node_id))) {
$span_name = $file_data['identifier'];
$span_description = $file_data['description'];
$span_size = $file_data['size'];
$span_mime = $file_data['mime_type'];
$start_path = '/root?action=file_select&node_id=' . $file_data['parent_node_id'];
} else {
$span_name = '';
$span_description = '';
$span_size = '';
$span_mime = '';
}
$start_path_condition = "";
if (!$start_path) {
$start_path = $this->get_attribute('start_path');
if (!$start_path) {
$start_path = session::get('limb_file_select_working_path');
}
if (!$start_path) {
$start_path = '/root/images_folder';
}
$start_path .= '?action=file_select';
}
$start_path_condition = "file_select_{$md5id}.set_start_path('{$start_path}');";
echo "<span id='{$md5id}_span_empty'><img src='/shared/images/no_img.gif'></span>\n \t\t\t\t<span id='{$md5id}_span_content'>\n \t\t\t\t\t<a id='{$md5id}_href' href='#'><img id='{$md5id}_img' align='center' src='/shared/images/1x1.gif'/> <span id='{$md5id}_name'>{$span_name}</span></a><br>\n \t\t\t\t\t<span id='{$md5id}_description'>{$span_description}</span><br>\n \t\t\t\t\tsize: <span id='{$md5id}_size'>{$span_size}</span> bytes <br>\n \t\t\t\t\tmime-type:<span id='{$md5id}_mime'>{$span_mime}</span>\n \t\t\t\t</span><br><br>";
echo "<script type='text/javascript'>\n\t\t \tvar file_select_{$md5id};\n\t\t \t\n\t\t function init_file_select_{$md5id}()\n\t\t {\n\t\t file_select_{$md5id} = new file_select('{$id}', '{$md5id}');\n\t\t {$start_path_condition}\n\t\t file_select_{$md5id}.generate();\n\t\t }\n\t\t \n\t\t function file_select_{$md5id}_insert_file(file)\n\t\t {\n\t\t \tfile_select_{$md5id}.insert_file(file);\n\t\t }\n\t\n\t\t function file_select_{$md5id}_get_file()\n\t\t {\n\t\t \treturn file_select_{$md5id}.get_file();\n\t\t }\n\t\t \n\t\t function file_reset_{$md5id}()\n\t\t {\n\t\t \tfile_select_{$md5id}.id_container.value = 0;\n\t\t \tinit_file_select_{$md5id}();\n\t\t }\n\t\t \n\t\t add_event(window, 'load', init_file_select_{$md5id});\n\t\t </script>";
echo "<input class='button' type='button' onclick='popup(\"/root/file_select?\", null, null, false, file_select_{$md5id}_insert_file, file_select_{$md5id}_get_file)' value='" . strings::get('select_file', 'file') . "'>";
echo ' ';
echo "<input class='button' type='button' onclick='file_reset_{$md5id}()' value='" . strings::get('reset') . "'>";
}
示例9: setcollecte
function setcollecte($id, $mode_paiement, $pj, $date_paiement)
{
global $db;
//$nextid=getnextidtable('collecte');
$date = date('Y-m-d-', strtotime($date_paiement));
$values["mode_paiement"] = MySQL::SQLValue($mode_paiement);
$values["date_paiement"] = MySQL::SQLValue($date);
$values["etat_paiement"] = MySQL::SQLValue("Payé");
$where["id"] = MySQL::SQLValue($id);
if (!$db->UpdateRows("collecte", $values, $where)) {
$db->Kill($db->Error());
return false;
} else {
$sql = $db->BuildSQLInsert("collecte", $values);
logg('Enregistrement collecte ', 195, $id, $_SESSION['userid']);
if ($pj != "") {
$basedir = "upload/collecte";
if (!file_exists($basedir)) {
mkdir($basedir, 0, true);
}
$newdir = $basedir . "/";
copyfile($pj, $id, $newdir, "Attachement_collecte_");
autoarchive($newdir . changnom($pj, $id, 'Attachement_collecte_'), "Fichier joint collecte {$id}", 195, $id, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
}
return true;
}
}
示例10: index
/**
* Display a listing of miembros
*
* @return Response
*/
public function index()
{
$miembros = Miembro::where('familia_id', '=', session::get('familia_id'))->get();
$familia = Familia::where('usuario_id', '=', Session::get('id'))->get();
// $miembros=Miembro::orderBy('created_at','desc')->limit(2)->get();
return View::make('back.Miembros.index', compact('miembros', 'familia'));
}
示例11: render_image_select
function render_image_select()
{
$id = $this->get_attribute('id');
$md5id = substr(md5($id), 0, 5);
$image_node_id = $this->get_value();
$start_path = '';
if ($image_node_id && ($image_data = fetch_one_by_node_id($image_node_id))) {
$span_name = $image_data['identifier'];
$start_path = '/root?action=image_select&node_id=' . $image_data['parent_node_id'];
} else {
$span_name = '';
}
if (!$start_path) {
$start_path = $this->get_attribute('start_path');
if (!$start_path) {
$start_path = session::get('limb_image_select_working_path');
}
if (!$start_path) {
$start_path = '/root/images';
}
$start_path .= '?action=image_select';
}
echo "<span id='{$md5id}_name'>{$span_name}</span><br><img id='{$md5id}_img' src='/shared/images/1x1.gif'/>\n <script type='text/javascript'>\n var image_select_{$md5id};\n\n function init_image_select_{$md5id}()\n {\n image_select_{$md5id} = new image_select('{$id}', '{$md5id}');\n image_select_{$md5id}.set_start_path('{$start_path}');\n image_select_{$md5id}.generate();\n }\n\n function image_select_{$md5id}_insert_image(image)\n {\n image_select_{$md5id}.insert_image(image);\n }\n\n function image_select_{$md5id}_get_image()\n {\n return image_select_{$md5id}.get_image();\n }\n\n function image_reset_{$md5id}()\n {\n image_select_{$md5id}.id_container.value = 0;\n init_image_select_{$md5id}();\n }\n\n add_event(window, 'load', init_image_select_{$md5id});\n </script>";
echo "<br><br><input class='button' type='button' onclick='popup(\"/root/tools/image_select?properties=0\", null, null, false, image_select_{$md5id}_insert_image, image_select_{$md5id}_get_image)' value='" . strings::get('select_image', 'image') . "'>";
echo ' ';
echo "<input class='button' type='button' onclick='image_reset_{$md5id}()' value='" . strings::get('reset') . "'>";
}
示例12: editdoc
function editdoc($titrfr, $titren, $titrar, $img, $id, $art, $typ)
{
global $db;
$values["titrfr"] = MySQL::SQLValue($titrfr);
$values["titren"] = MySQL::SQLValue($titren);
$values["titrar"] = MySQL::SQLValue($titrar);
$values["article"] = MySQL::SQLValue($art);
$values["typ"] = MySQL::SQLValue($typ);
if ($img != "") {
$values["img"] = MySQL::SQLValue(changnom($img, $id, 'doc_'));
}
$where["id"] = MySQL::SQLValue($id);
// Execute the insert
$result = $db->UpdateRows("document", $values, $where);
// If we have an error
if (!$result) {
// Show the error and kill the script
$db->Kill('Error Update');
return false;
} else {
if ($img != "") {
$olddir = "upload/doc/";
$newdir = "../upload/doc/";
copyfile($img, $id, $newdir, "doc_");
autoarchive($newdir . changnom($img, $id, 'doc_'), "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
}
return true;
}
}
示例13: getMenu
public function getMenu($menu)
{
//Llama a una funcion del ACL que carga los menus
$menus['sidebar'] = $this->_registry->_acl->getMenusRole();
if (Session::get('autenticado')) {
$titulos = array(array('id' => 'inicio', 'titulo' => 'Inicio', 'enlace' => BASE_URL, 'imagen' => 'icon-home'), array('id' => 'post', 'titulo' => 'Posts', 'enlace' => BASE_URL . 'post', 'imagen' => 'icon-flag'));
// para la redcetpros
if (Session::get('clave_cetpro') == 'redcetpros') {
$nom_cetpro = 'Red CETPROS UGEL 04';
} else {
throw new Exception('hola mucamos');
$nom_cetpro = 'CETPRO ' . implode($this->_modelo->getCetproFromClave(Session::get('clave_cetpro')));
}
$menus['top'] = array('titulos' => $titulos, 'ruta_img' => BASE_URL . 'layouts/sigace/img/', 'usuario' => ucwords(strtolower(session::get('nombre') . " " . session::get('ape_pat') . " " . session::get('ape_mat'))), 'cetpro_clave' => Session::get('clave_cetpro'), 'cetpro' => $nom_cetpro, 'role' => implode($this->_modelo->getRole(session::get('id_role'))));
}
/*
if(!Session::get('autenticado')){
$menus['top'][] = array(
'id' => 'registro',
'titulo' => 'Registro',
'enlace' => BASE_URL . 'usuarios/registro',
'imagen' => 'icon-book'
);
}
*/
return $menus[$menu];
}
示例14: admin
function admin()
{
global $CONF, $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['a_header'];
if (!isset($_COOKIE['atsphp_sid_admin'])) {
$this->login();
} else {
require_once "{$CONF['path']}/sources/misc/session.php";
$session = new session();
list($type, $data) = $session->get($_COOKIE['atsphp_sid_admin']);
if ($type == 'admin') {
$session->update($_COOKIE['atsphp_sid_admin']);
// Array containing the valid .php files from the sources/admin directory
$action = array('approve' => 1, 'approve_edited' => 1, 'approve_reviews' => 1, 'backup_database' => 1, 'create_page' => 1, 'delete' => 1, 'delete_bad_word' => 1, 'delete_ban' => 1, 'delete_page' => 1, 'delete_review' => 1, 'edit' => 1, 'edit_page' => 1, 'edit_bad_word' => 1, 'edit_ban' => 1, 'edit_review' => 1, 'email' => 1, 'manage' => 1, 'manage_bad_words' => 1, 'manage_ban' => 1, 'manage_pages' => 1, 'manage_reviews' => 1, 'settings' => 1, 'skins' => 1);
if (isset($FORM['b']) && isset($action[$FORM['b']])) {
$page_name = $FORM['b'];
require_once "{$CONF['path']}/sources/admin/{$page_name}.php";
$page = new $page_name();
$TMPL['content'] = $this->do_skin('admin');
} elseif (isset($FORM['b']) && $FORM['b'] == 'logout') {
$this->logout();
} else {
$this->main();
}
} else {
$this->login();
}
}
}
示例15: editcollecte
function editcollecte($idcontrat, $paiement, $date, $pj)
{
global $db;
$usrid = $_SESSION['userid'];
$nextid = getnextidtable('collecte');
//$date1=date_create($date);
//$datep=date_format($date1,"Y-m-d");
$date_paiement = date('Y-m-d-', strtotime($date));
$values["mode_paiement"] = MySQL::SQLValue($paiement);
$values["date_paiement"] = MySQL::SQLValue($date_paiement);
$where["id"] = MySQL::SQLValue($idcontrat);
if (!$db->UpdateRows("collecte", $values, $where)) {
$db->Kill($db->Error());
return false;
} else {
$sql = $db->BuildSQLInsert("collecte", $values);
logg('Enregistrement collecte ', 201, $nextid, $_SESSION['userid']);
if ($pj != "") {
$basedir = "upload/collecte";
if (!file_exists($basedir)) {
mkdir($basedir, 0, true);
}
$newdir = $basedir . "/";
copyfile($pj, $nextid, $newdir, "collecte");
autoarchive($newdir . changnom($pj, $nextid, 'collecte'), "Fichier joint collecte {$nextid}", 201, $nextid, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
}
return true;
}
}