本文整理匯總了PHP中session::Started方法的典型用法代碼示例。如果您正苦於以下問題:PHP session::Started方法的具體用法?PHP session::Started怎麽用?PHP session::Started使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類session
的用法示例。
在下文中一共展示了session::Started方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_current_user
private function get_current_user($sessID)
{
$sess = new session($sessID);
if ($sess->Started()) {
$person = new person();
$person->load_current_user($sess->Get("personID"));
// update session_started, which affects session lifetime
$sess->Save();
return $person;
}
}
示例2: session
function get_url()
{
global $sess;
$sess or $sess = new session();
$url = "project/project.php?projectID=" . $this->get_id();
if ($sess->Started()) {
$url = $sess->url(SCRIPT_PATH . $url);
// This for urls that are emailed
} else {
static $prefix;
$prefix or $prefix = config::get_config_item("allocURL");
$url = $prefix . $url;
}
return $url;
}
示例3: session
function get_url($absolute = false, $id = false)
{
global $sess;
$sess or $sess = new session();
$id or $id = $this->get_id();
$url = "task/task.php?taskID=" . $id;
if ($sess->Started() && !$absolute) {
$url = $sess->url(SCRIPT_PATH . $url);
// This for urls that are emailed
} else {
static $prefix;
$prefix or $prefix = config::get_config_item("allocURL");
$url = $prefix . $url;
}
return $url;
}
示例4: date
$TPL["current_date"] = date("Y-m-d H:i:s");
$TPL["today"] = date("Y-m-d");
// The default From: email address
if (config::get_config_item("AllocFromEmailAddress")) {
define("ALLOC_DEFAULT_FROM_ADDRESS", add_brackets(config::get_config_item("AllocFromEmailAddress")));
}
// The default email bounce address
define("ALLOC_DEFAULT_RETURN_PATH_ADDRESS", config::get_config_item("allocEmailAdmin"));
// If a script has NO_AUTH enabled, then it will perform its own
// authentication. And will be responsible for setting up any of:
// $current_user and $sess.
if (!defined("NO_AUTH")) {
$current_user =& singleton("current_user", new person());
$sess = new session();
// If session hasn't been started re-direct to login page
if (!$sess->Started()) {
defined("NO_REDIRECT") && exit("Session expired. Please <a href='" . $TPL["url_alloc_login"] . "'>log in</a> again.");
alloc_redirect($TPL["url_alloc_login"] . ($_SERVER['REQUEST_URI'] != '/' ? '?forward=' . urlencode($_SERVER['REQUEST_URI']) : ''));
// Else load up the current_user and continue
} else {
if ($sess->Get("personID")) {
$current_user->load_current_user($sess->Get("personID"));
}
}
}
// Setup all the urls
require_once ALLOC_MOD_DIR . "shared" . DIRECTORY_SEPARATOR . "global_tpl_values.inc.php";
$TPL = get_alloc_urls($TPL, $sess);
// Add user's navigation to quick list dropdown
if (is_object($current_user) && $current_user->get_id()) {
$history = new history();
示例5: session
* along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
define("NO_AUTH", 1);
require_once "../alloc.php";
$sess = new session();
if (isset($_POST["forwardUrl"])) {
$url = $_POST["forwardUrl"];
} else {
if (isset($_GET["forward"])) {
$url = $_GET["forward"];
} else {
$url = $sess->GetUrl($TPL["url_alloc_home"]);
}
}
// If we already have a session
if ($sess->Started()) {
alloc_redirect($url);
exit;
// Else log the user in
} else {
if ($_POST["login"]) {
$person = new person();
$row = $person->get_valid_login_row($_POST["username"], $_POST["password"]);
if ($row) {
$sess->Start($row);
$q = prepare("UPDATE person SET lastLoginDate = '%s' WHERE personID = %d", date("Y-m-d H:i:s"), $row["personID"]);
$db = new db_alloc();
$db->query($q);
if ($sess->TestCookie()) {
$sess->UseCookie();
$sess->SetTestCookie($_POST["username"]);