Skip to content

Instantly share code, notes, and snippets.

@luniki
Last active December 20, 2015 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luniki/6183252 to your computer and use it in GitHub Desktop.
Save luniki/6183252 to your computer and use it in GitHub Desktop.
Stud.IP: Vergleich eines Fake-Logins für 2.3 und später
<?
protected function start_session($user_id)
{
global $perm, $user, $auth, $sess, $forced_language, $_language;
$user = new Seminar_User();
$user->start($user_id);
foreach (array(
"uid" => $user_id,
"perm" => $user->perms,
"uname" => $user->username,
"auth_plugin" => $user->auth_plugin,
"exp" => time() + 60 * 15,
"refresh" => time()
) as $k => $v) {
$auth->auth[$k] = $v;
}
$auth->nobody = false;
$sess->regenerate_session_id(array('auth', 'forced_language','_language'));
$sess->freeze();
}
<?
// Fake user identity
$user = User::find($user_id);
$GLOBALS['auth'] = new Seminar_Auth();
$GLOBALS['auth']->auth = array(
'uid' => $user->user_id,
'uname' => $user->username,
'perm' => $user->perms,
);
$GLOBALS['user'] = new Seminar_User($user->user_id);
$GLOBALS['perm'] = new Seminar_Perm();
$GLOBALS['MAIL_VALIDATE_BOX'] = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment