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


PHP drupal_session_regenerate函数代码示例

本文整理汇总了PHP中drupal_session_regenerate函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_session_regenerate函数的具体用法?PHP drupal_session_regenerate怎么用?PHP drupal_session_regenerate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: filter_init

 function filter_init()
 {
     global $conf, $user;
     // Inject values into the $conf array - will apply to all sites.
     // This can be a useful place to apply generic development settings.
     $conf_inject = unserialize(urldecode(runserver_env('RUNSERVER_CONF')));
     // Merge in the injected conf, overriding existing items.
     $conf = array_merge($conf, $conf_inject);
     // Log in user if needed.
     if (isset($_GET['login'])) {
         $uid = runserver_env('RUNSERVER_USER');
         if (!empty($uid) && $user->uid !== $uid) {
             // If a user was provided, log in as this user.
             $user = user_load($uid);
             if (function_exists('drupal_session_regenerate')) {
                 // Drupal 7
                 drupal_session_regenerate();
             } else {
                 // Drupal 6
                 sess_regenerate();
             }
         }
         // Refresh the page (in case access denied has been called already).
         drupal_goto($_GET['q']);
     }
 }
开发者ID:AndBicScadMedia,项目名称:drush-ops.github.com,代码行数:26,代码来源:runserver-prepend.php

示例2: system_boot

 function system_boot()
 {
     global $conf, $user;
     // Inject values into the $conf array - will apply to all sites.
     // This can be a useful place to apply generic development settings.
     $conf_inject = unserialize(urldecode($_SERVER['RUNSERVER_CONF']));
     // Merge in the injected conf, overriding existing items.
     $conf = array_merge($conf, $conf_inject);
     if (isset($_SERVER['RUNSERVER_USER'])) {
         // If a user was provided, log in as this user.
         $user = unserialize(urldecode($_SERVER['RUNSERVER_USER']));
         if (function_exists('drupal_session_regenerate')) {
             // Drupal 7
             drupal_session_regenerate();
         } else {
             // Drupal 6
             sess_regenerate();
         }
     }
 }
开发者ID:redb,项目名称:MNPP,代码行数:20,代码来源:runserver-prepend.php

示例3: strrpos

    $pos1 = strrpos($str2, '--');
    $username = substr($str2, 0, $pos1);
    $password = substr($str2, $pos1 + 2);
    $param = array('UserName' => "{$username}", 'Password' => "{$password}");
    $client = new soapclient('http://etypeservices.com/Service_SubscriberLogin.asmx?WSDL');
    $response = $client->ValidateSubscriber($param);
    if ($response->ValidateSubscriberResult == 1) {
        $query = "select name, uid from users where name='" . $username . "'";
        $qu = db_query($query);
        $useruid = "";
        foreach ($qu as $qu) {
            $useruid = $qu->uid;
        }
        global $user;
        $user = user_load($useruid);
        drupal_session_regenerate();
    }
}
function encrypt_decrypt($action, $string)
{
    $output = false;
    $encrypt_method = "AES-256-CBC";
    $secret_key = 'This is my secret key';
    $secret_iv = 'This is my secret iv';
    // hash
    $key = hash('sha256', $secret_key);
    // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
    $iv = substr(hash('sha256', $secret_iv), 0, 16);
    if ($action == 'encrypt') {
        $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
        $output = base64_encode($output);
开发者ID:etype-services,项目名称:lsn,代码行数:31,代码来源:page.tpl.php

示例4: regenerate

 /**
  * {@InheritDoc}
  */
 public function regenerate($destroy = false, $lifetime = null)
 {
     $this->start();
     drupal_session_regenerate();
 }
开发者ID:Djecan,项目名称:EkinoDrupalBundle,代码行数:8,代码来源:DrupalSessionStorage.php

示例5: switchUser

 /**
  * Switches to a different user.
  *
  * We don't call session_save_session() because we really want to change users.
  * Usually unsafe!
  *
  * @param string $name
  *   The username to switch to, or NULL to log out.
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function switchUser($name = NULL)
 {
     global $user;
     $module_handler = $this->moduleHandler();
     if ($uid = $this->currentUser()->id()) {
         $module_handler->invokeAll('user_logout', array($user));
     }
     if (isset($name) && ($account = user_load_by_name($name))) {
         $old_uid = $uid;
         $user = $account;
         $user->timestamp = time() - 9999;
         if (!$old_uid) {
             // Switch from anonymous to authorized.
             drupal_session_regenerate();
         }
         $module_handler->invokeAll('user_login', array($user));
     } elseif ($uid) {
         session_destroy();
     }
     $destination = drupal_get_destination();
     $url = $this->urlGenerator()->generateFromPath($destination['destination'], array('absolute' => TRUE));
     return new RedirectResponse($url);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:34,代码来源:DevelController.php

示例6: getEntitlements

 function getEntitlements($params)
 {
     //$query = $this->getEntitlementsQuery2();
     //$entitlements = $this->queryMSSQL('Etype', $query, $params);
     //echo "entitlements: ", count($entitlements), " results\n"; print_r($entitlements); echo "\n";
     $username = $params['0']['0'];
     $Password = $params['0']['1'];
     // this result means the username/password did not return a record
     $param12 = array('UserName' => "{$username}");
     $client12 = new soapclient('http://etypeservices.com/service_GetPublicationIDByUserName.asmx?WSDL');
     $response12 = $client12->GetPublicationID($param12);
     if ($response12->GetPublicationIDResult == -9) {
         $return = $this->buildOutput("KO", "User or password invalid. Please try again");
     } else {
         if ($response12->GetPublicationIDResult == 1213) {
             $param = array('UserName' => "{$username}", 'Password' => "{$Password}");
             $client = new soapclient('http://etypeservices.com/Service_SubscriberLogin.asmx?WSDL');
             $response = $client->ValidateSubscriber($param);
             if ($response->ValidateSubscriberResult == -5) {
                 $return = $this->buildOutput("KO", "User or password invalid. Please try again");
             } elseif ($response->ValidateSubscriberResult == -1) {
                 $expired = array();
                 // expired subscriptions
                 $canView = array();
                 // active subscriptions
                 //$pubview =array();
                 $outputStarter = "<key>output</key><array>";
                 $outputBody = '';
                 $outputEnder = "</array>";
                 $pubview = $response12->GetPublicationIDResult;
                 $pre = "smr";
                 $canView[strtolower($pre)] = true;
                 $return = $this->buildOutput("KO", "Your subscription to San Marcos Record expired . Please contact the Helpdesk to renew your subscription", $canView, $pubview, $pre);
             } else {
                 $expired = array();
                 // expired subscriptions
                 $canView = array();
                 // active subscriptions
                 //$pubview =array();
                 $outputStarter = "<key>output</key><array>";
                 $outputBody = '';
                 $outputEnder = "</array>";
                 $pubview = $response12->GetPublicationIDResult;
                 $query = "select name, uid from users where name='" . $username . "'";
                 $qu = db_query($query);
                 $useruid = "";
                 foreach ($qu as $qu) {
                     $useruid = $qu->uid;
                 }
                 global $user;
                 $user = user_load($useruid);
                 drupal_session_regenerate();
                 $pre = "smr";
                 $canView[strtolower($pre)] = true;
                 $return = $this->buildOutput("OK", "Success", $canView, $pubview, $pre);
             }
         } else {
             $return = $this->buildOutput("KO", "User or password invalid. Please try again");
         }
     }
     return $return;
 }
开发者ID:etype-services,项目名称:moser,代码行数:62,代码来源:node--7636.tpl.php

示例7: devis_form_legal_login_submit

/**
 * This function is copying the same code from legal.
 */
function devis_form_legal_login_submit($form, &$form_state)
{
    // This is a copy from the legal module.
    global $user;
    $values = $form_state['values'];
    $user = user_load($values['uid']);
    $redirect = 'user/' . $user->uid;
    if (!empty($_GET['destination'])) {
        $redirect = $_GET['destination'];
    }
    $form_state['redirect'] = $redirect;
    // Update the user table timestamp noting user has logged in.
    db_update('users')->fields(array('login' => time()))->condition('uid', $user->uid)->execute();
    // User has new permissions, so we clear their menu cache.
    cache_clear_all($user->uid, 'cache_menu', TRUE);
    // Fixes login problems in Pressflow.
    drupal_session_regenerate();
    user_module_invoke('login', $edit, $user);
}
开发者ID:daniosoriov,项目名称:devis,代码行数:22,代码来源:template.php


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