本文整理匯總了PHP中session::check方法的典型用法代碼示例。如果您正苦於以下問題:PHP session::check方法的具體用法?PHP session::check怎麽用?PHP session::check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類session
的用法示例。
在下文中一共展示了session::check方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: check
static function check($key)
{
if (is_array($key)) {
$set = true;
foreach ($key as $k) {
if (!session::check($k)) {
$set = false;
}
}
return $set;
} else {
$key = session::generateSessionKey($key);
return isset($_SESSION[$key]);
}
}
示例2: drawWidget
function drawWidget()
{
$s = new session();
if (session::check() != false) {
$w = new box($this->logged_in_realm_caption);
$w->css_box = "login";
$w->addWidget(html::write($this->logged_in_caption . $s->user->username));
$w->addWidget(new button($this->logout_caption, $this->logouttarget . "?logout=1"));
return $w->draw();
}
$h = new html();
$h->html .= "\n\t\t\t\t\t\n\t\t\t\t\t<form method=\"post\" action=\"" . $this->target . "\">\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t" . $this->realm_caption . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td>" . $this->username_caption . "</td><td><input type=\"text\" name=\"username\"></td></tr>\t\t\t\n\t\t\t\t\t\t<tr><td>" . $this->password_caption . "</td><td><input type=\"password\" name=\"password\"></td></tr>\n\t\t\t\t\t\t<tr><td><input type=\"submit\" value=\"" . $this->submit_caption . "\"></td></tr></table></form>";
$b = new box($this->realm_caption, $h);
$b->css_box = "login";
return $b->draw();
}
示例3: preg_replace
/**
* This file is used to verify that the session parameters are correct
* In case of invalid Session, the script is stopped
*/
require_once 'class/Session.class.php';
// Caller script should pass a GET parameter with the domain name
//gj([X.X.X] - sanitize input, register patterns globally for readability and consistency. email, adword, instance, etc)^M
$domain = preg_replace("/[^a-zA-Z0-9\\-\\.]/", "", $_REQUEST['domain']);
$databaseName = preg_replace("/[^a-zA-Z0-9\\_]/", "", $_REQUEST['databaseName']);
if ($domain == null || $domain == "") {
echo json_encode(array('error' => "parameter", 'errorMsg' => "Invalid parameter domain!"));
die;
}
// Get the instance name from the domain
// Open the session of the instance database
//$instance = getInstanceNameFromDomain($domain);
$instance = $databaseName;
session::initByInstance($instance);
session::check();
//Verify that the instance session has the checkout information
// and the same domain
if (!isset($_SESSION['checkoutCampaign'])) {
echo json_encode(array('error' => "Session", 'errorMsg' => "Missing Session Information! Instance name:" . $instance . " , domain name: " . $domain));
die;
} else {
$domainFromSession = $_SESSION['checkoutCampaign']['instanceHost'];
if ($domain != $domainFromSession) {
echo json_encode(array('error' => "Session", 'errorMsg' => "Invalid domain information!"));
die;
}
}
示例4: Main
<?php
include '../core/main.class.php';
$main = new Main();
//check for loged in
$id = Security::secureString($_GET['id']);
$idea = mysql_fetch_array($main->con()->db_query("SELECT votes FROM feedback_ideas WHERE id='{$id}'"));
if (session::check()) {
$voter_id = session::get_param('user_id');
$main->con()->db_query("UPDATE feedback_ideas SET votes=votes+1 WHERE id='{$id}'");
$main->con()->db_query("INSERT INTO feedback_votes (idea_id,voter_id) VALUES('{$id}','{$voter_id}')");
}
echo render::dynamicFont(number_format($idea['votes'] + 1, 0, '', ','), 32);
?>
<br/>
votes<br/>
示例5: Main
<?php
include '../core/main.class.php';
$main = new Main();
//check for loged in
$id = Security::secureString($_GET['id']);
$status = Security::secureString($_GET['status']);
if (session::check() && session::get_param('admin')) {
$main->con()->db_query("UPDATE feedback_ideas SET status='{$status}' WHERE id='{$id}'");
$info = array('status' => '<div id="status_' . $id . '" class="nr_votes ' . render::giveStatus($status, "class") . '">' . render::giveStatus($status, "text") . '</div>', 'adm_com' => '<div id="com_status_' . $id . '" class="ad_' . render::giveStatus($status, "class") . '"></div>');
echo json_encode($info);
}
示例6:
</div>
</div>
<div id="blackout"></div>
<div id="content">
<a href="<?php
echo HTTP_CORE_BASE;
?>
"><img src="<?php
echo HTTP_CORE_BASE;
?>
images/logo.jpg" alt="logo"/></a>
<br clear="all"/>
<div class="title fleft"><b>Chocksy</b> Feedback</div>
<div class="get_in">
<?php
if (!session::check()) {
?>
<a href="<?php
echo HTTP_CORE_BASE;
?>
getin">Login</a> sau <a href="<?php
echo HTTP_CORE_BASE;
?>
getin">Register</a>
<?php
} else {
?>
<a href="javascript:void(0)" onclick="OPN.logout()">Log Out</a>
<?php
}
?>
示例7: isLoggedIn
function isLoggedIn()
{
$check = array("id", "username", "admin", "fname", "lname");
if (session::check($check)) {
return true;
} else {
return false;
}
}
示例8: checkVoted
public static function checkVoted($idea_id, $voted_ideas)
{
if (self::array_search_r($idea_id, $voted_ideas) || !session::check()) {
return true;
} else {
return false;
}
}
示例9: init
public function init()
{
if (!session::check('user')) {
$this->redirect(Request::createUrl('login', 'login'));
}
}