Some login functions.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-08-09 08:29:51 +00:00
parent 942f555425
commit 6328a98e81
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
function verify_login($user, $password) {
global $wpdb;
$user = $wpdb->escape($user);
$password = $password;
if ( $user = $wpdb->get_row("SELECT user_login, user_pass FROM $wpdb->users WHERE user_login = '$user'") ) {
if ( $user->user_pass = md5($password) )
return true;
else
return false;
} else {
return false;
}
}
function verify_current() {
if (!empty($_COOKIE['wordpressuser_' . COOKIEHASH])) {
$user_login = $_COOKIE['wordpressuser_' . COOKIEHASH];
$user_pass = $_COOKIE['wordpresspass_' . COOKIEHASH];
} else {
return false;
}
if ('' == $user_login)
return false;
if ('' == $user_pass)
return false;
if ( verify_login($user_login, $user_pass) {
return true;
} else {
header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']) );
exit();
}
}
?>