本文整理汇总了PHP中session_pagestart函数的典型用法代码示例。如果您正苦于以下问题:PHP session_pagestart函数的具体用法?PHP session_pagestart怎么用?PHP session_pagestart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了session_pagestart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Abstractify
function Abstractify($version, $wpu_version)
{
//
// CLASS CONSTRUCTOR
// ------------------------------
//
$version = $version == 'PHPBB3' ? 'PHPBB3' : 'PHPBB2';
$this->ver = $version;
$this->wpu_ver = $wpu_version;
if ('PHPBB3' == $this->ver) {
define('GENERAL_ERROR', 100);
define('CRITICAL_ERROR', -100);
if (!$GLOBALS['user']->data) {
$GLOBALS['user']->session_begin();
$GLOBALS['auth']->acl($GLOBALS['user']->data);
$GLOBALS['user']->setup('mods/wp-united');
} else {
$GLOBALS['user']->add_lang('mods/wp-united');
}
} else {
if (!$GLOBALS['userdata']) {
$GLOBALS['userdata'] = session_pagestart($GLOBALS['user_ip'], PAGE_BLOG);
init_userprefs($userdata);
}
global $lang, $phpEx, $board_config, $phpbb_root_path;
include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_wp-united.' . $phpEx;
}
}
示例2: init
/**
* Initialize phpBB.
*
* @param $args An associative array, which may contain the following options:
* template: Whether the default header and footer should be printed. Defaults to true.
* admin: Whether the visitor must be an administrator. Defaults to false.
* check_sid: Whether 'sid' parameter should be checked against the visitor's actual SID.
* Defaults to true if 'admin' is set to true, otherwise defaults to false.
* root: Specify the phpbb root path. Defaults to './'.
* page: The page type, as will be shown in the administration panel. Defaults to PAGE_MODERATING
* title: The page title.
*/
public static function init($args = array())
{
global $phpbb_root_path, $phpEx, $user_ip, $userdata, $db, $themes_id, $board_config, $template, $theme, $lang, $page_title, $SID, $html_entities_match, $html_entities_replace, $user_ip, $attachment_mod, $unhtml_specialchars_match, $unhtml_specialchars_replace;
define('IN_PHPBB', true);
if (isset($args['root'])) {
$phpbb_root_path = $args['root'];
} else {
$phpbb_root_path = './';
}
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
// Start session management.
if (!isset($args['page'])) {
$args['page'] = PAGE_MODERATING;
}
$userdata = session_pagestart($user_ip, $args['page']);
init_userprefs($userdata);
// Check whether user is admin.
if ($args['admin'] && $userdata['user_level'] != ADMIN) {
message_die(GENERAL_MESSAGE, "You are not an administrator.");
}
// Check session ID if necessary.
if (!isset($args['check_sid']) && $args['admin'] || $args['check_sid']) {
// Session ID check.
if (!empty($_POST['sid']) || !empty($_GET['sid'])) {
$sid = !empty($_POST['sid']) ? $_POST['sid'] : $_GET['sid'];
} else {
$sid = '';
}
if ($sid == '' || $sid != $userdata['session_id']) {
message_die(GENERAL_ERROR, 'Invalid session.');
}
}
$SID = $userdata['session_id'];
// Print default header and footer.
if (isset($args['title'])) {
$page_title = $args['title'];
}
if (!isset($args['template']) || $args['template']) {
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
}
self::$phpBB_args = $args;
}
示例3: define
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$viewcat = !empty($HTTP_GET_VARS[POST_CAT_URL]) ? $HTTP_GET_VARS[POST_CAT_URL] : -1;
if (isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark'])) {
$mark_read = isset($HTTP_POST_VARS['mark']) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
} else {
$mark_read = '';
}
//
// Handle marking posts
//
if ($mark_read == 'forums') {
if ($userdata['session_logged_in']) {
示例4: topic_review
function topic_review($topic_id, $is_inline_review)
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
global $userdata, $user_ip;
global $orig_word, $replacement_word;
global $starttime;
if (!$is_inline_review) {
if (!isset($topic_id)) {
message_die(GENERAL_MESSAGE, 'Topic_not_exist');
}
//
// Get topic info ...
//
$sql = "SELECT t.topic_title, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments \n\t\t\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f \n\t\t\tWHERE t.topic_id = {$topic_id}\n\t\t\t\tAND f.forum_id = t.forum_id";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
if (!($forum_row = $db->sql_fetchrow($result))) {
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$db->sql_freeresult($result);
$forum_id = $forum_row['forum_id'];
$topic_title = $forum_row['topic_title'];
//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
if (!$is_auth['auth_read']) {
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']));
}
}
//
// Define censored word matches
//
if (empty($orig_word) && empty($replacement_word)) {
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
}
//
// Dump out the page header and load viewtopic body template
//
if (!$is_inline_review) {
$gen_simple_header = TRUE;
$page_title = $lang['Topic_review'] . ' - ' . $topic_title;
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
$template->set_filenames(array('reviewbody' => 'posting_topic_review.tpl'));
}
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid\n\t\tFROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND p.poster_id = u.user_id\n\t\t\tAND p.post_id = pt.post_id\n\t\tORDER BY p.post_time DESC\n\t\tLIMIT " . $board_config['posts_per_page'];
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain post/user information', '', __LINE__, __FILE__, $sql);
}
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
if ($row = $db->sql_fetchrow($result)) {
$mini_post_img = $images['icon_minipost'];
$mini_post_alt = $lang['Post'];
$i = 0;
do {
$poster_id = $row['user_id'];
$poster = $row['username'];
$post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
//
// Handle anon users posting with usernames
//
if ($poster_id == ANONYMOUS && $row['post_username'] != '') {
$poster = $row['post_username'];
$poster_rank = $lang['Guest'];
} elseif ($poster_id == ANONYMOUS) {
$poster = $lang['Guest'];
$poster_rank = '';
}
$post_subject = $row['post_subject'] != '' ? $row['post_subject'] : '';
$message = $row['post_text'];
$bbcode_uid = $row['bbcode_uid'];
//
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if (!$board_config['allow_html'] && $row['enable_html']) {
$message = preg_replace('#(<)([\\/]?.*?)(>)#is', '<\\2>', $message);
}
if ($bbcode_uid != "") {
$message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
}
$message = make_clickable($message);
if (count($orig_word)) {
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
$message = preg_replace($orig_word, $replacement_word, $message);
//.........这里部分代码省略.........
示例5: generate_smilies
function generate_smilies($mode, $page_id)
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
global $user_ip, $session_length, $starttime;
global $userdata;
//-- mod : rank color system ---------------------------------------------------
//-- add
global $get;
//-- fin mod : rank color system -----------------------------------------------
$inline_columns = 4;
$inline_rows = 9;
$window_columns = 8;
if ($mode == 'window') {
$userdata = session_pagestart($user_ip, $page_id);
init_userprefs($userdata);
$gen_simple_header = TRUE;
$page_title = $lang['Emoticons'];
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
$template->set_filenames(array('smiliesbody' => 'posting_smilies.tpl'));
} elseif ($mode == 'window_announcement_text') {
$userdata = session_pagestart($user_ip, $page_id);
init_userprefs($userdata);
$gen_simple_header = TRUE;
$page_title = $lang['Site_Announcement'];
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
$template->set_filenames(array('smiliesbody' => 'posting_smilies_announcement_centre_text.tpl'));
}
$sql = "SELECT emoticon, code, smile_url \r\n\t\tFROM " . SMILIES_TABLE . " \r\n\t\tORDER BY smilies_id";
if ($result = $db->sql_query($sql, false, true)) {
$num_smilies = 0;
$rowset = array();
while ($row = $db->sql_fetchrow($result)) {
if (empty($rowset[$row['smile_url']])) {
$rowset[$row['smile_url']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code']));
$rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
$num_smilies++;
}
}
if ($num_smilies) {
$smilies_count = $mode == 'inline' ? min(19, $num_smilies) : $num_smilies;
$smilies_split_row = $mode == 'inline' ? $inline_columns - 1 : $window_columns - 1;
$s_colspan = 0;
$row = 0;
$col = 0;
while (list($smile_url, $data) = @each($rowset)) {
if (!$col) {
$template->assign_block_vars('smilies_row', array());
}
$template->assign_block_vars('smilies_row.smilies_col', array('SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, 'SMILEY_DESC' => $data['emoticon']));
$s_colspan = max($s_colspan, $col + 1);
if ($col == $smilies_split_row) {
if ($mode == 'inline' && $row == $inline_rows - 1) {
break;
}
$col = 0;
$row++;
} else {
$col++;
}
}
if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
$template->assign_block_vars('switch_smilies_extra', array());
$template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES' => append_sid("posting.{$phpEx}?mode=smilies")));
}
$template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
}
}
if ($mode == 'window' || $mode == 'window_announcement_text') {
$template->pparse('smiliesbody');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
}
}
示例6: define
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
define('IN_PHPBB', true);
define('IN_ADR_ZONES', true);
define('IN_ADR_CHARACTER', true);
$phpbb_root_path = './';
include_once $phpbb_root_path . 'extension.inc';
include_once $phpbb_root_path . 'common.' . $phpEx;
//
// Start session management
$userdata = session_pagestart($user_ip, PAGE_ADR);
init_userprefs($userdata);
// End session management
//
$user_id = $userdata['user_id'];
include_once $phpbb_root_path . 'adr/includes/adr_global.' . $phpEx;
// Sorry , only logged users ...
if (!$userdata['session_logged_in']) {
$redirect = "adr_character.{$phpEx}";
$redirect .= isset($user_id) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.{$phpEx}?redirect={$redirect}", true));
}
// Includes the tpl and the header
adr_template_file('adr_tower_body.tpl');
include_once $phpbb_root_path . 'includes/page_header.' . $phpEx;
// Get the general config and character infos
示例7: get_var
<?php
/**
*
* @package attachment_mod
* @version $Id: uacp.php 192 2007-01-20 15:17:44Z kronos $
* @copyright (c) 2002 Meik Sievertsen
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
// session id check
$sid = get_var('sid', '');
// Start session management
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);
// session id check
if ($sid == '' || $sid != $userdata['session_id']) {
//message_die(GENERAL_ERROR, 'Invalid_session');
message_die(GENERAL_ERROR, 'Invalid_session:<br >' . $sid . '<br />' . $userdata['session_id']);
}
// Obtain initial var settings
$user_id = get_var(POST_USERS_URL, 0);
if (!$user_id) {
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
// Begin PNphpBB2 Module
// $profiledata = get_userdata($user_id);
$profiledata = phpbb_get_userdata($user_id);
// End PNphpBB2 Module
if ($profiledata['user_id'] != $userdata['user_id'] && $userdata['user_level'] != ADMIN) {
示例8: define
* email : fr@php-styles.com
* Last update : July 2004 - FR
*
***************************************************************************/
/***************************************************************************
*
* This hack is released under the GPL License.
* This hack can be freely used, but not distributed, without permission.
* Intellectual Property is retained by the author listed above.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include_once $phpbb_root_path . 'auction/auction_common.php';
// Start session management
$userdata = session_pagestart($user_ip, AUCTION_ROOM);
init_userprefs($userdata);
// End session management
// Check auction_permission
checkPermission('VIEW_ALL');
// Information for the standard Who-is-Online-Block
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if ($total_posts == 0) {
$l_total_post_s = $lang['Posted_articles_zero_total'];
} else {
if ($total_posts == 1) {
$l_total_post_s = $lang['Posted_article_total'];
示例9: define
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
require_once $phpbb_root_path . 'extension.inc';
require_once $phpbb_root_path . 'common.' . $phpEx;
require_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
define('NUM_SHOUT', 20);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SHOUTBOX_MAX);
init_userprefs($userdata);
//
// End session management
//
//
// Start auth check
//
switch ($userdata['user_level']) {
//Costomice this, if you need other permission settings
// please also make same changes to other shoutbox php files
case ADMIN:
case MOD:
$is_auth['auth_mod'] = 1;
default:
$is_auth['auth_read'] = 1;
示例10: session_pagestart
<?php
@($userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length));
@init_userprefs($userdata);
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip \n FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s \n WHERE u.user_id = s.session_user_id \n AND s.session_time >= " . (time() - 300) . "\n ORDER BY u.username ASC, s.session_ip ASC";
$result = $db->sql_query($sql);
if (!$result) {
message_die(GENERAL_ERROR, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql);
}
$userlist_ary = array();
$userlist_visible = array();
$logged_visible_online = 0;
$logged_hidden_online = 0;
$guests_online = 0;
$online_userlist = "";
$prev_user_id = 0;
$prev_session_ip = 0;
while ($row = $db->sql_fetchrow($result)) {
if ($row['session_logged_in']) {
if ($row['user_id'] != $prev_user_id) {
$style_color = "";
if ($row['user_level'] == ADMIN) {
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
} else {
if ($row['user_level'] == MOD) {
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
}
}
if ($row['user_allow_viewonline']) {
示例11: define
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = "./";
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . "common.{$phpEx}";
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_LINKS);
init_userprefs($userdata);
require $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main_link.' . $phpEx;
//
// Count and forwrad
//
if ($HTTP_GET_VARS['action'] == "go" && $HTTP_GET_VARS['link_id']) {
$link_id = $HTTP_GET_VARS['link_id'];
// Secure check
if (is_numeric($link_id)) {
$sql = "SELECT link_id, link_url, last_user_ip\n\t\t\tFROM " . LINKS_TABLE . "\n\t\t\tWHERE link_id = '{$link_id}'\n\t\t\tAND link_active = 1";
if ($result = $db->sql_query($sql)) {
$row = $db->sql_fetchrow($result);
if ($link_url = $row['link_url']) {
if ($user_ip != $row['last_user_ip']) {
// Update
示例12: define
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'areabb/fonctions/preload.' . $phpEx;
$userdata = session_pagestart($user_ip, PAGE_ARCADES);
init_userprefs($userdata);
//
// Fonction permettant de zipper un dossier.
function zipDir($path, &$zip, $dossier = '')
{
if (!is_dir($path)) {
return;
}
if (!($dh = @opendir($path))) {
message_die(GENERAL_ERROR, 'Une erreur s\'est produite sur ' . $path);
exit;
}
while ($file = readdir($dh)) {
if (is_dir($path . '/' . $file) && $file != '.' && $file != '..') {
zipDir($path . '/' . $file, $zip, $dossier . '/' . $file);
} elseif (is_file($path . '/' . $file)) {
$zip->addFile(file_get_contents($path . '/' . $file), $dossier . '/' . $file);
}
}
}
//
// Création du package du jeu demandé
function package_jeu($titre)
示例13: topic_review
// that review ...
//
if ($mode == 'topicreview') {
require $phpbb_root_path . 'includes/topic_review.' . $phpEx;
topic_review($topic_id, false);
exit;
} else {
if ($mode == 'smilies') {
generate_smilies('window', PAGE_POSTING);
exit;
}
}
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING);
init_userprefs($userdata);
//
// End session management
//
//
// Was cancel pressed? If so then redirect to the appropriate
// page, no point in continuing with any further checks
//
if (isset($HTTP_POST_VARS['cancel'])) {
if ($post_id) {
$redirect = "viewtopic.{$phpEx}?" . POST_POST_URL . "={$post_id}";
$post_append = "#{$post_id}";
} else {
if ($topic_id) {
$redirect = "viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}";
示例14: define
* email : fr@php-styles.com
* Last update : July 2004 - FR
*
***************************************************************************/
/***************************************************************************
*
* This hack is released under the GPL License.
* This hack can be freely used, but not distributed, without permission.
* Intellectual Property is retained by the author listed above.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include_once $phpbb_root_path . 'auction/auction_common.php';
// Start session management
$userdata = session_pagestart($user_ip, AUCTION_SITEMAP);
init_userprefs($userdata);
// End session management
// Check permissions for auction
checkPermission('VIEW_ALL');
// Information for the standard Who-is-Online-Block
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if ($total_posts == 0) {
$l_total_post_s = $lang['Posted_articles_zero_total'];
} else {
if ($total_posts == 1) {
$l_total_post_s = $lang['Posted_article_total'];
示例15: Header
if (preg_match("~mainfile.php~i", $PHP_SELF)) {
Header("Location: index.php");
die;
}
require_once dirname(__FILE__) . "/mysql.php";
// Make the database connection.
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if (!$db->db_connect_id) {
echo "Could not connect to the database<br>";
exit;
}
// require_once dirname(__FILE__)."/sessions.php";
require_once dirname(__FILE__) . "/functions.php";
require_once dirname(__FILE__) . "/common.php";
// standard session management
$userdata = session_pagestart($user_ip, PAGE_LEONARDO);
// init_userprefs($userdata);
$LEO_lang['ENCODING'] = $langEncodings[$currentlang];
// set page title
$page_title = 'LEONARDO';
//------------------------------------------------------------
$userdata['user_id'] = $user->id;
$userdata['username'] = $user->username;
if (isset($_SESSION['user_id'])) {
$userdata['user_id'] = $_SESSION['user_id'];
$userdata['username'] = $_SESSION['username'];
}
function is_user($user)
{
global $db, $user_prefix, $CONF;
if (!is_array($user)) {