本文整理汇总了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']);
}
}
示例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();
}
}
}
示例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);
示例4: regenerate
/**
* {@InheritDoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
$this->start();
drupal_session_regenerate();
}
示例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);
}
示例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;
}
示例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);
}