本文整理汇总了PHP中checksession函数的典型用法代码示例。如果您正苦于以下问题:PHP checksession函数的具体用法?PHP checksession怎么用?PHP checksession使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checksession函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Machine
print "{$message}";
}
}
}
} else {
if (isset($_GET['mlog'])) {
$mc = new Machine();
$mc->setMachineID($_GET['mid']);
$mc->showMachineLog();
}
if (isset($_GET['actlid'])) {
$ml->setValue('activitylogid', $_GET['actlid']);
$ml->showMaintenanceUI();
}
if (isset($_GET['session'])) {
checksession('activitylog.html');
}
if (isset($_GET['ui'])) {
$ml->setValue('mainttypeid', $_GET['mtid']);
$ml->setValue('machineid', $_GET['mcid']);
$ml->showMaintenanceUI();
}
if (isset($_GET['gspmlist'])) {
$spm = new SPMaintenance();
$spm->setValue('machineid', $_GET['mcid']);
$spm->createSPMTitleList();
$sel = new selectlist('SPM_ID', $spm->getSPMTitleList(), 'Select Maintenance Plan', 'SPM_ID', 'SPM_Title', 'class="required"', '', '1');
}
if (isset($_GET['gprop'])) {
$ml->setValue('spmid', $_GET['spmid']);
$ml->showGPUI();
示例2: session_start
<?php
session_start();
$page_title = 'Change your password';
include 'includes/header.php';
require 'checksession.php';
checksession();
//Starts the connection to the database.
require '../mysqli_connect.php';
// Check for form submission:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$errors = array();
// Initialize an error array.
// Check for a password and match against the confirmed password:
if (!empty($_POST['pass1'])) {
if (preg_match("/^[a-zA-Z(0-9)+]{8,}\$/", $_POST['pass1'])) {
if ($_POST['pass1'] != $_POST['pass2']) {
$errors[] = 'Your password did not match the confirmed password.';
} else {
$passwd = mysqli_real_escape_string($dbc, trim($_POST['pass1']));
}
} else {
$errors[] = 'Your password doesn\'t match the minimum requeriments';
}
} else {
$errors[] = 'You forgot to enter your password.';
}
if (empty($errors)) {
// If everything's OK.
// Make the update with the new password:
$q = "UPDATE USERS SET passwd=SHA1('{$passwd}') WHERE uid={$_SESSION['uid']} LIMIT 1";
示例3: do_articles
function do_articles()
{
global $context, $txt, $settings, $boardurl, $scripturl, $smcFunc;
// do an update of stray articles and categories
$acats = array();
$request = $smcFunc['db_query']('', '
SELECT id FROM {db_prefix}tp_variables
WHERE type = {string:type}', array('type' => 'category'));
if ($smcFunc['db_num_rows']($request) > 0) {
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$acats[] = $row['id'];
}
$smcFunc['db_free_result']($request);
}
if (count($acats) > 0) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_variables
SET value2 = {int:val2}
WHERE type = {string:type}
AND value2 NOT IN ({array_string:value2})', array('val2' => 0, 'type' => 'category', 'value2' => $acats));
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET category = {int:cat}
WHERE category NOT IN({array_int:category})
AND category > 0', array('cat' => 0, 'category' => $acats));
}
// first check any ajax stuff
if (isset($_GET['arton'])) {
checksession('get');
$what = is_numeric($_GET['arton']) ? $_GET['arton'] : '0';
if ($what > 0) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET off = IF(off = 0 , 1, 0)
WHERE id = {int:artid}', array('artid' => $what));
} else {
return;
}
} elseif (isset($_GET['artlock'])) {
checksession('get');
$what = is_numeric($_GET['artlock']) ? $_GET['artlock'] : '0';
if ($what > 0) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET locked = IF(locked = 0 , 1, 0)
WHERE id = {int:artid}', array('artid' => $what));
} else {
return;
}
} elseif (isset($_GET['artsticky'])) {
checksession('get');
$what = is_numeric($_GET['artsticky']) ? $_GET['artsticky'] : '0';
if ($what > 0) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET sticky = IF(sticky = 0 , 1, 0)
WHERE id = {int:artid}', array('artid' => $what));
} else {
return;
}
} elseif (isset($_GET['artfront'])) {
checksession('get');
$what = is_numeric($_GET['artfront']) ? $_GET['artfront'] : '0';
if ($what > 0) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET frontpage = IF(frontpage = 0 , 1, 0)
WHERE id = {int:artid}', array('artid' => $what));
} else {
return;
}
} elseif (isset($_GET['artfeat'])) {
checksession('get');
$what = is_numeric($_GET['artfeat']) ? $_GET['artfeat'] : '0';
if ($what > 0) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET featured = IF(featured = 0, 1, 0)
WHERE id = {int:artid}', array('artid' => $what));
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET featured = {int:featured}
WHERE id != {int:artid}', array('featured' => 0, 'artid' => $what));
} else {
return;
}
} elseif (isset($_GET['catdelete'])) {
checksession('get');
$what = is_numeric($_GET['catdelete']) ? $_GET['catdelete'] : '0';
if ($what > 0) {
// first get info
$request = $smcFunc['db_query']('', '
SELECT id, value2 FROM {db_prefix}tp_variables
WHERE id = {int:varid} LIMIT 1', array('varid' => $what));
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
$newcat = !empty($row['value2']) ? $row['value2'] : 0;
$smcFunc['db_query']('', '
UPDATE {db_prefix}tp_variables
SET value2 = {int:val2}
//.........这里部分代码省略.........
示例4: sqllink
<?php
require_once "function/sqllink.php";
require_once "function/encryption.php";
$link = sqllink();
if (checksession($link) == FALSE) {
die("0");
}
$id = $_SESSION['userid'];
$index = $_POST['index'];
if (!$link->beginTransaction()) {
die('0');
}
$sql = "SELECT * FROM `password` WHERE `userid`= ? AND `index`= ? ";
$res = sqlexec($sql, array($id, (int) $index), $link);
$record = $res->fetch(PDO::FETCH_ASSOC);
if ($record == FALSE) {
$link->commit();
die("0");
}
$ppwd = $_POST['newpwd'];
$pubkey = mt_rand(10000000, 99999999);
$newpw = encrypt($ppwd, $pubkey);
$changedCols = "`key` = ? ,`pwd` = ?";
$values = array($pubkey, $newpw);
if (isset($_POST["name"])) {
$changedCols .= " ,`name` = ?";
array_push($values, $_POST["name"]);
}
if (isset($_POST["other"])) {
$changedCols .= " ,`other` = ?";
示例5: redirect
<!DOCTYPE HTML>
<html>
<head>
<title>Paathshaala Profile</title>
<?php
include_once 'source.php';
include_once 'functions/functions.php';
include_once 'functions/class.user.php';
if (!checksession()) {
redirect();
} else {
$u = new user($_SESSION['uid']);
}
echo $header;
?>
<link rel='stylesheet' href='css/profile.css'>
</head>
<body>
<div id='topbar'></div>
<img src="pics/load.gif" id='loading' style='display:none;'>
<div id='container'>
<?php
echo $topBar;
echo $feedback;
?>
<div id='editProfile'></div>
<div id='profileBox'>
<img id='editProfileButton' src='pics/settings.png'/ >
<div id='snapShot'>
<img src="<?php
示例6: header
} else {
$_SESSION["error"] = "pwsnotthere";
header("Location:settings.php");
}
}
if (isset($_POST['addurl'])) {
echo checkadmin($_SESSION["userid"], $con);
if (checkadmin($_SESSION["userid"], $con) == true) {
header('Location:home.php');
} else {
$URL = $_POST["URL"];
if ($URL != '') {
if (checkurl($URL) == true) {
$id = $_SESSION["userid"];
mysqli_query($con, "INSERT INTO project (website,owner_project) VALUES ('{$URL}','{$id}')");
checksession($id, $con);
} else {
$_SESSION["error"] = "invalidurlformat";
header('Location:createsession.php');
}
} else {
$_SESSION["error"] = "invalidurl";
header('Location:createsession.php');
}
}
}
if (isset($_POST['changeurl'])) {
$URL = $_POST["newurl"];
$id = $_SESSION["userid"];
if ($URL == mysqli_fetch_assoc(mysqli_query($con, "SELECT website FROM project WHERE owner_project='{$id}'"))['website']) {
$_SESSION["error"] = "sameurl";
示例7: random_str
function random_str($length)
{
$arr = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z'));
$str = '';
$arr_len = count($arr);
for ($i = 0; $i < $length; $i++) {
$rand = mt_rand(0, $arr_len - 1);
$str .= $arr[$rand];
}
return $str;
}
require_once "function/sqllink.php";
require_once "function/encryption.php";
$link = sqllink();
if (!checksession($link)) {
die("0");
}
$id = $_SESSION['userid'];
$usr = $_SESSION['user'];
$username = $_POST['user'];
$device = $_POST['device'];
$sig = $_POST['sig'];
if ($username != $usr) {
die('0');
}
$sql = "DELETE FROM `pin` WHERE `userid`= ? AND `device`= ?";
$res = sqlexec($sql, array($id, $device), $link);
$pinpk = random_str(29);
$sql = "INSERT INTO `pin` (`userid`,`device`,`pinsig`,`pinpk`,`ua`) VALUES (?,?,?,?,?)";
$res = sqlexec($sql, array($id, $device, $sig, $pinpk, $_SERVER['HTTP_USER_AGENT']), $link);
示例8: session_unset
}
if (isset($_SESSION['user'])) {
if (isset($_SESSION["LAST_ACTIVITY"])) {
if (time() - $_SESSION["LAST_ACTIVITY"] > 300) {
// last request was more than 30 minutes ago
session_unset();
// unset $_SESSION variable for the run-time
session_destroy();
// destroy session data in storage
return false;
} else {
$_SESSION["LAST_ACTIVITY"] = time();
// update last activity time stamp
return true;
}
}
}
return false;
}
if (isset($_GET['check'])) {
if (isset($_GET['sgid'])) {
$sgid = $_GET['sgid'];
} else {
$sgid = '';
}
if (checksession($sgid)) {
echo '1';
} else {
echo '0';
}
}
示例9: header
<?php
require_once 'autoload.php';
include 'checksession.php';
if (!checksession()) {
header('Location: login.php');
}
$au = new Approval();
$commallowed = array('2', '17');
if (isset($_SESSION['operatorid'])) {
$au->setValue('operatorid', $_SESSION['operatorid']);
$me = new Message();
$me->setTo($_SESSION['operatorid']);
$nm = $me->getMessagecount();
} else {
checksession('index.php');
}
echo <<<_END
<!DOCTYPE HTML>
<head>
<meta charset="utf-8" />
<title>Divya Engineering ERP</title>
<link href="js/css/sm-core-css.css" rel="stylesheet" type="text/css" />
<link href="js/css/sm-blue/sm-blue.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-2.1.4.min.js" ></script>
<script src="js/jquery.smartmenus.js" ></script>
<script>