More cookie catchups

git-svn-id: http://svn.automattic.com/wordpress/trunk@2726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-07-18 20:12:48 +00:00
parent 41afea2f94
commit 6a30e8033f
3 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,7 @@ if (!function_exists('_')) {
function get_profile($field, $user = false) { function get_profile($field, $user = false) {
global $wpdb; global $wpdb;
if (!$user) if (!$user)
$user = $wpdb->escape($_COOKIE['wordpressuser_' . COOKIEHASH]); $user = $wpdb->escape($_COOKIE[USER_COOKIE]);
return $wpdb->get_var("SELECT $field FROM $wpdb->users WHERE user_login = '$user'"); return $wpdb->get_var("SELECT $field FROM $wpdb->users WHERE user_login = '$user'");
} }

View File

@ -8,10 +8,10 @@ if ( !function_exists('get_currentuserinfo') ) :
function get_currentuserinfo() { function get_currentuserinfo() {
global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user;
if ( !isset($_COOKIE['wordpressuser_' . COOKIEHASH])) if ( !isset($_COOKIE[USER_COOKIE]))
return false; return false;
$user_login = $_COOKIE['wordpressuser_' . COOKIEHASH]; $user_login = $_COOKIE[USER_COOKIE];
$userdata = get_userdatabylogin($user_login); $userdata = get_userdatabylogin($user_login);
$user_level = $userdata->user_level; $user_level = $userdata->user_level;
$user_ID = $userdata->ID; $user_ID = $userdata->ID;
@ -149,9 +149,9 @@ endif;
if ( !function_exists('auth_redirect') ) : if ( !function_exists('auth_redirect') ) :
function auth_redirect() { function auth_redirect() {
// Checks if a user is logged in, if not redirects them to the login page // Checks if a user is logged in, if not redirects them to the login page
if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && if ( (!empty($_COOKIE[USER_COOKIE]) &&
!wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true)) || !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
(empty($_COOKIE['wordpressuser_' . COOKIEHASH])) ) { (empty($_COOKIE[USER_COOKIE])) ) {
nocache_headers(); nocache_headers();
header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));

View File

@ -165,10 +165,10 @@ default:
$user_pass = $_POST['pwd']; $user_pass = $_POST['pwd'];
$redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_POST['redirect_to']); $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_POST['redirect_to']);
} elseif ( !empty($_COOKIE) ) { } elseif ( !empty($_COOKIE) ) {
if (! empty($_COOKIE['wordpressuser_' . COOKIEHASH]) ) if (! empty($_COOKIE[USER_COOKIE]) )
$user_login = $_COOKIE['wordpressuser_' . COOKIEHASH]; $user_login = $_COOKIE[USER_COOKIE];
if (! empty($_COOKIE['wordpresspass_' . COOKIEHASH]) ) { if (! empty($_COOKIE[PASS_COOKIE]) ) {
$user_pass = $_COOKIE['wordpresspass_' . COOKIEHASH]; $user_pass = $_COOKIE[PASS_COOKIE];
$using_cookie = true; $using_cookie = true;
} }
} }