当前位置: 首页>>代码示例>>PHP>>正文


PHP session::init方法代码示例

本文整理汇总了PHP中session::init方法的典型用法代码示例。如果您正苦于以下问题:PHP session::init方法的具体用法?PHP session::init怎么用?PHP session::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在session的用法示例。


在下文中一共展示了session::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * @TODO - there has to be a less heavy way of doing this...
  */
 public function init($username = null)
 {
     global $db, $cache, $plugins;
     global $groupscache, $forum_cache, $fpermcache, $mybb, $cached_forum_permissions_permissions, $cached_forum_permissions;
     if (!defined('IN_MYBB')) {
         define('IN_MYBB', true);
     }
     @(include_once dirname(DOCROOT) . '/mies/inc/init.php');
     @(include_once MYBB_ROOT . 'inc/class_session.php');
     try {
         ob_start();
         if (isset($mybb)) {
             $session = new \session();
             $session->init();
             $mybb->session =& $session;
             $this->myBB = $mybb;
         } else {
             $this->myBB = new \stdClass();
             $this->myBB->user = ['username' => null];
             if ($this->app['config']['mybb']['allowRandom']) {
                 $this->myBB->user['username'] = $username;
             }
         }
         ob_end_clean();
     } catch (\Exception $e) {
         throw new AuthenticationException('Could not initialize MYBB application for authentication.');
     }
 }
开发者ID:Gipetto,项目名称:Chatfort54,代码行数:31,代码来源:MyBBUserProvider.php

示例2: __construct

 function __construct()
 {
     parent::__construct();
     session::init();
     session::loginAuth("dashboard");
     $this->breadcrumb->add("Dashboard", "dashboard");
 }
开发者ID:kronxblue,项目名称:1stg,代码行数:7,代码来源:dashboard.php

示例3: __construct

 function __construct()
 {
     $this->view = new view();
     $this->model = new model();
     $this->view->base_url = 'http://' . URL;
     session::init();
 }
开发者ID:GlennWatt,项目名称:personalWebSpace,代码行数:7,代码来源:controller.php

示例4: delete

 public static function delete($key)
 {
     if (!self::$_init) {
         session::init();
     }
     unset($_SESSION[$key]);
 }
开发者ID:romancient,项目名称:php-testtask,代码行数:7,代码来源:core.php

示例5: __construct

 function __construct()
 {
     parent::__construct();
     session::init();
     session::loginAuth("setup");
     $this->breadcrumb->add("Account Setup", "setup");
     $this->user = user::getUserData('agent_id', session::get(AGENT_SESSION_NAME));
 }
开发者ID:kronxblue,项目名称:1stg,代码行数:8,代码来源:setup.php

示例6: check

 static function check()
 {
     session_set_cookie_params(SESSION_EXPIRE);
     if (empty($_SESSION['running'])) {
         // There is no session or session expired
         session::init();
     }
     // Reset the expiration time upon page load
     if (isset($_COOKIE[session_name()])) {
         setcookie(session_name(), $_COOKIE[session_name()], time() + SESSION_EXPIRE, "/");
     }
 }
开发者ID:highfidelity,项目名称:love,代码行数:12,代码来源:Session.class.php

示例7: callback

 public function callback()
 {
     // $oauth_verifier = filter_input(INPUT_GET, 'oauth_verifier');
     //
     // if (empty($oauth_verifier) || empty(session::get('tw_oauth_token')) || empty(session::get('tw_oauth_secret'))) {
     //     // something's missing, go and login again
     //     header('Location: ' . tw_url_login);
     // }
     session::init();
     $request_token = array();
     $request_token['oauth_token'] = session::get('tw_oauth_token');
     $request_token['oauth_token_secret'] = session::get('tw_oauth_token_secret');
     // connect with application token
     $connection = new TwitterOAuth(tw_consumer_key, tw_consumer_secret, $request_token['oauth_token'], $request_token['oauth_token_secret']);
     // request user token
     $token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));
     // session::set('tw_token',$token);
     auth::setLogin($token, true, $db = $this->db);
     session::remove('tw_oauth_token');
     session::remove('tw_oauth_token_secret');
     header('Location: /');
     //
     //
     // $twitter = new TwitterOAuth(
     //   tw_consumer_key,
     //   tw_consumer_secret,
     //   $token['oauth_token'],
     //   $token['oauth_token_secret']
     // );
     //
     // print_r($token);
     //
     // $result = $twitter->get('users/show', array('user_id'=>$token['user_id']));
     //
     // print_r($result);
     //
     // $status = $twitter->post(
     //   "statuses/update", [
     //     "status" => "m2m dene".date("Y-m-d h:i:sa")
     //   ]
     // );
     //
     // echo ('Created new status with #' . $status->id . PHP_EOL);
 }
开发者ID:emreplt,项目名称:keepitter,代码行数:44,代码来源:login_model.php

示例8: __construct

 function __construct()
 {
     session::init();
     $this->breadcrumb = new breadcrumb();
     $this->view = new view();
     $this->_userProfileImages = IMAGES_PATH . "user-default.png";
     if (session::exist(AGENT_SESSION_NAME) and session::exist(AGENT_LOGIN_SESSION)) {
         $agent_id = session::get(AGENT_SESSION_NAME);
         $userData = new user();
         //            USERDATA
         $this->_userData = $userData->getUserData('agent_id', $agent_id);
         $user = $this->_userData;
         //            USER ACC. TYPE
         $userAccType = user::getAccType($user['acc_type']);
         $this->_userAccType = $userAccType['label'];
         //            PROFILE IMAGE
         $profileImageExist = user::checkExist("user_images", "agent_id = '{$agent_id}' AND profile = '1'");
         if ($profileImageExist) {
             $image = user::getUserImages($agent_id, TRUE);
             $this->_userProfileImages = IMAGES_PATH . "users/" . $image['filename'];
         }
         //            AVAILABLE COMMISSION
         $this->_availableCommission = user::getAvailableComm($agent_id);
         //            BADGE
         $countAccPaymentBadge = user::countBadge("user_payment", "status = '0'");
         $this->_accPaymentBadge = $countAccPaymentBadge > 0 ? $countAccPaymentBadge : "";
         $countWithdrawalBadge = user::countBadge("user_withdrawal", "status = '0' OR status = '1'");
         $this->_withdrawalBadge = $countWithdrawalBadge > 0 ? $countWithdrawalBadge : "";
         //            $countMessageBadge = user::countBadge("user_messages", "agent_id = '$agent_id' AND status = '0'");
         //            $this->_messageBadge = ($countMessageBadge > 0) ? $countMessageBadge : "";
     }
     $this->view->_userData = $this->_userData;
     $this->view->_userAccType = $this->_userAccType;
     $this->view->_userProfileImages = $this->_userProfileImages;
     $this->view->_availableCommission = $this->_availableCommission;
     //        BADGE
     $this->view->_accPaymentBadge = $this->_accPaymentBadge;
     $this->view->_withdrawalBadge = $this->_withdrawalBadge;
     //        $this->view->_messageBadge = $this->_messageBadge;
 }
开发者ID:kronxblue,项目名称:1stg,代码行数:40,代码来源:controller.php

示例9: runReg

 public function runReg($log, $pass)
 {
     $sth = $this->db->prepare("SELECT id, name, role FROM boat_users WHERE email=:email AND password=:password");
     $sth->execute(array(':email' => $log, ':password' => $pass));
     $data = $sth->fetch();
     //print_r($data);
     //echo $data['role'];
     //die();
     $count = $sth->rowCount();
     if ($count > 0) {
         //login
         session::init();
         session::set('role', $data['role']);
         session::set('userId', $data['id']);
         session::set('userName', $data['name']);
         session::set('userEmail', $log);
         session::set('loggedIn', TRUE);
         header('location: ../dashboard');
     } else {
         //error
         header('location: ../login');
     }
 }
开发者ID:vistazp,项目名称:boatseller,代码行数:23,代码来源:signup_model.php

示例10: tt_login_success

function tt_login_success()
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $mobiquo_config, $user, $register;
    if ($user['coppauser']) {
        error($lang->error_awaitingcoppa);
    }
    my_setcookie('loginattempts', 1);
    $db->delete_query("sessions", "ip='" . $db->escape_string($session->ipaddress) . "' AND sid != '" . $session->sid . "'");
    $newsession = array("uid" => $user['uid']);
    $db->update_query("sessions", $newsession, "sid='" . $session->sid . "'");
    $db->update_query("users", array("loginattempts" => 1), "uid='{$user['uid']}'");
    my_setcookie("mybbuser", $user['uid'] . "_" . $user['loginkey'], null, true);
    my_setcookie("sid", $session->sid, -1, true);
    $mybb->cookies['sid'] = $session->sid;
    $session = new session();
    $session->init();
    $mybbgroups = $mybb->user['usergroup'];
    if ($mybb->user['additionalgroups']) {
        $mybbgroups .= ',' . $mybb->user['additionalgroups'];
    }
    $groups = explode(",", $mybbgroups);
    $xmlgroups = array();
    foreach ($groups as $group) {
        $xmlgroups[] = new xmlrpcval($group, "string");
    }
    tt_update_push();
    if ($settings['maxattachments'] == 0) {
        $settings['maxattachments'] = 100;
    }
    $userPushType = array('pm' => 1, 'newtopic' => 1, 'sub' => 1, 'tag' => 1, 'quote' => 1);
    $push_type = array();
    foreach ($userPushType as $name => $value) {
        $push_type[] = new xmlrpcval(array('name' => new xmlrpcval($name, 'string'), 'value' => new xmlrpcval($value, 'boolean')), 'struct');
    }
    if ($mybb->settings['postfloodsecs'] && !is_moderator(0, "", $mybb->user['uid'])) {
        $flood_interval = $mybb->settings['postfloodsecs'];
    }
    $result = array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'user_id' => new xmlrpcval($mybb->user['uid'], 'string'), 'username' => new xmlrpcval(basic_clean($mybb->user['username']), 'base64'), 'login_name' => new xmlrpcval(basic_clean($mybb->user['username']), 'base64'), 'user_type' => check_return_user_type($mybb->user['username']), 'email' => new xmlrpcval(basic_clean($mybb->user['email']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($mybb->user['avatar']), 'string'), 'post_count' => new xmlrpcval(intval($mybb->user['postnum']), 'int'), 'usergroup_id' => new xmlrpcval($xmlgroups, 'array'), 'ignored_uids' => new xmlrpcval($mybb->user['ignorelist'], 'string'), 'max_png_size' => new xmlrpcval(10000000, "int"), 'max_jpg_size' => new xmlrpcval(10000000, "int"), 'max_attachment' => new xmlrpcval($mybb->usergroup['canpostattachments'] == 1 ? $settings['maxattachments'] : 0, "int"), 'can_upload_avatar' => new xmlrpcval($mybb->usergroup['canuploadavatars'] == 1, "boolean"), 'can_pm' => new xmlrpcval($mybb->usergroup['canusepms'] == 1 && !$mobiquo_config['disable_pm'], "boolean"), 'can_send_pm' => new xmlrpcval($mybb->usergroup['cansendpms'] == 1 && !$mobiquo_config['disable_pm'], "boolean"), 'can_moderate' => new xmlrpcval($mybb->usergroup['canmodcp'] == 1, "boolean"), 'can_search' => new xmlrpcval($mybb->usergroup['cansearch'] == 1, "boolean"), 'can_whosonline' => new xmlrpcval($mybb->usergroup['canviewonline'] == 1, "boolean"), 'register' => new xmlrpcval($register, "boolean"), 'push_type' => new xmlrpcval($push_type, 'array'), 'post_countdown' => new xmlrpcval($flood_interval, 'int'));
    if ($mybb->usergroup['isbannedgroup'] == 1) {
        // Fetch details on their ban
        $query = $db->simple_select("banned", "*", "uid='{$mybb->user['uid']}'", array('limit' => 1));
        $ban = $db->fetch_array($query);
        if ($ban['uid']) {
            // Format their ban lift date and reason appropriately
            if ($ban['lifted'] > 0) {
                $banlift = my_date($mybb->settings['dateformat'], $ban['lifted']) . ", " . my_date($mybb->settings['timeformat'], $ban['lifted']);
            } else {
                $banlift = $lang->banned_lifted_never;
            }
            $reason = htmlspecialchars_uni($ban['reason']);
        }
        if (empty($reason)) {
            $reason = $lang->unknown;
        }
        if (empty($banlift)) {
            $banlift = $lang->unknown;
        }
        $result_text = $lang->banned_warning . $lang->banned_warning2 . ": " . $reason . "\n" . $lang->banned_warning3 . ": " . $banlift;
        $result['result_text'] = new xmlrpcval($result_text, 'base64');
    }
    return new xmlrpcresp(new xmlrpcval($result, 'struct'));
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:62,代码来源:mobiquo_common.php

示例11: accountswitcher_switch

/**
 * The switch function deletes the mybbuser cookie, sets a new cookie for the selected account and starts a new session.
 * Function is called by ajax request and sends the new users post key.
 *
 */
function accountswitcher_switch()
{
    global $db, $mybb, $lang, $charset, $cache, $templates;
    if ($mybb->user['uid'] != 0 && isset($mybb->input['switchuser']) && $mybb->input['switchuser'] == 1 && $mybb->request_method == "post") {
        require_once MYBB_ROOT . "/inc/plugins/accountswitcher/class_accountswitcher.php";
        $eas = new AccountSwitcher($mybb, $db, $cache, $templates);
        // Get permissions for this user
        $userPermission = user_permissions($mybb->user['uid']);
        // Get permissions for the master. First get the master
        $master = get_user((int) $mybb->user['as_uid']);
        // Get his permissions
        $masterPermission = user_permissions($master['uid']);
        // If one of both has the permission allow to switch
        if ($userPermission['as_canswitch'] == 1 || $masterPermission['as_canswitch'] == 1) {
            if (!isset($lang->as_invaliduser)) {
                $lang->load("accountswitcher");
            }
            verify_post_check($mybb->get_input('my_post_key'));
            // Get user info
            $user = get_user($mybb->get_input('uid', MyBB::INPUT_INT));
            // Check if user exists
            if (!$user) {
                error($lang->as_invaliduser);
            }
            // Can the new account be shared?
            if ($user['as_share'] != 0 && $mybb->settings['aj_shareuser'] == 1) {
                // Account already used by another user?
                if ($user['as_shareuid'] != 0) {
                    log_moderator_action(array('uid' => $user['uid'], 'username' => $user['username']), $lang->aj_switch_invalid_log);
                    return;
                }
                // Account only shared by buddies?
                if ($user['as_buddyshare'] != 0) {
                    // No buddy - no switch
                    if ($user['buddylist'] != '') {
                        $buddylist = explode(",", $user['buddylist']);
                    }
                    if (empty($buddylist) || !empty($buddylist) && !in_array($mybb->user['uid'], $buddylist)) {
                        log_moderator_action(array('uid' => $user['uid'], 'username' => $user['username']), $lang->aj_switch_invalid_log);
                        return;
                    }
                }
                // Shared account is free - set share uid
                if ($user['as_shareuid'] == 0) {
                    $updated_shareuid = array("as_shareuid" => (int) $mybb->user['uid']);
                    $db->update_query("users", $updated_shareuid, "uid='" . (int) $user['uid'] . "'");
                    $eas->update_accountswitcher_cache();
                    $user['as_shareuid'] = (int) $mybb->user['uid'];
                }
            }
            // Make sure you can switch to an attached account only
            if ($user['as_uid'] == $mybb->user['uid'] || $user['as_uid'] != 0 && $user['as_uid'] == $mybb->user['as_uid'] || $user['uid'] == $mybb->user['as_uid'] || $user['as_shareuid'] == $mybb->user['uid'] || $user['uid'] == $mybb->user['as_shareuid']) {
                // Is the current account shared?
                if ($mybb->user['as_share'] != 0) {
                    // Account used by another user?
                    if ($mybb->user['as_shareuid'] == 0) {
                        log_moderator_action(array('uid' => $user['uid'], 'username' => $user['username']), $lang->aj_switch_invalid_log);
                        return;
                    }
                    // Reset share uid
                    if ($mybb->user['as_shareuid'] != 0) {
                        $updated_shareuid = array("as_shareuid" => 0);
                        $db->update_query("users", $updated_shareuid, "uid='" . (int) $mybb->user['uid'] . "'");
                        $eas->update_accountswitcher_cache();
                    }
                }
                // Log the old user out
                my_unsetcookie("mybbuser");
                my_unsetcookie("sid");
                if ($mybb->user['uid']) {
                    $time = TIME_NOW;
                    // Run this after the shutdown query from session system
                    $db->shutdown_query("UPDATE " . TABLE_PREFIX . "users SET lastvisit='{$time}', lastactive='{$time}' WHERE uid='{$mybb->user['uid']}'");
                    $db->delete_query("sessions", "sid = '{$session->sid}'");
                }
                // Now let the login datahandler do the work
                require_once MYBB_ROOT . "inc/datahandlers/login.php";
                $loginhandler = new LoginDataHandler("get");
                $mybb->input['remember'] = "yes";
                $loginhandler->set_data($user);
                $validated = $loginhandler->validate_login();
                $loginhandler->complete_login();
                // Create session for this user
                require_once MYBB_ROOT . "inc/class_session.php";
                $session = new session();
                $session->init();
                $mybb->session =& $session;
                $mybb->post_code = generate_post_check();
                // Send new users post code
                header("Content-type: text/plain; charset={$charset}");
                echo $mybb->post_code;
                exit;
            } else {
                log_moderator_action(array('uid' => $user['uid'], 'username' => $user['username']), $lang->aj_switch_invalid_log);
                error($lang->as_notattacheduser);
//.........这里部分代码省略.........
开发者ID:ambsalinas,项目名称:anima,代码行数:101,代码来源:as_functions.php

示例12: Date

        <link rel="alternate" href="http://feeds.feedburner.com/dotnetboard" title="Web Job Board: dotnetnow.com" type="application/rss+xml" /> 
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-65671466-1', 'auto');
  ga('send', 'pageview');

</script>
<!-- Yandex.Metrika counter --><script type="text/javascript"> (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter31664836 = new Ya.Metrika({ id:31664836, clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true, trackHash:true }); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="https://mc.yandex.ru/watch/31664836" style="position:absolute; left:-9999px;" alt="" /></div></noscript><!-- /Yandex.Metrika counter -->
        
    </head>
    <?php 
session::init();
?>
    <body>       
        <div class="container" >
            <div id="header" class="span-24">
                <div id="logo" class="span-7">
                    <a href="http://dotnetnow.com/"></a>
                </div>
                <div id="navigation" class="span-17 last">
                    <div id="top-nav" class="span-17 last">
                        <a href="<?php 
echo URL;
?>
">Home</a> |
                        <a href="<?php 
echo URL;
开发者ID:vistazp,项目名称:boatseller,代码行数:31,代码来源:headerNoSubscribe.php

示例13: __construct

 function __construct()
 {
     session::init();
 }
开发者ID:emreplt,项目名称:keepitter,代码行数:4,代码来源:view.php

示例14: session

 function init_session()
 {
     global $session;
     if (!isset($session)) {
         require_once MYBB_ROOT . 'inc/class_session.php';
         $session = new session();
         $session->init();
     }
 }
开发者ID:ambsalinas,项目名称:anima,代码行数:9,代码来源:ougc_pages.php

示例15: loginUserIntoSession

function loginUserIntoSession()
{
    //gj([X.X.X] - sanitize input, register patterns globally for readability and consistency. email, adword, instance, etc)
    $user_id = intval($_REQUEST['user_id']);
    $username = preg_replace("/[^a-zA-Z0-9\\+\\.\\_\\@\\-]/", "", $_REQUEST['username']);
    $nickname = preg_replace("/[^a-zA-Z0-9\\.\\_\\-\\ ]/", "", $_REQUEST['nickname']);
    $admin = preg_replace("/[^a-zA-Z0-9\\-\\_]/", "", $_REQUEST['admin']);
    $session_id = preg_replace("/[^a-zA-Z0-9\\-\\,]/", "", $_REQUEST['session_id']);
    session_id($session_id);
    session::init();
    Utils::setUserSession($user_id, $username, $nickname, $admin);
}
开发者ID:highfidelity,项目名称:love,代码行数:12,代码来源:api.php


注:本文中的session::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。