Last active
December 20, 2015 19:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// 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