Changeset 1730
- Timestamp:
- 10/04/2004 04:30:45 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-login.php
r1526 r1730 1 1 <?php 2 require(dirname(__FILE__) . '/wp-config.php'); 2 require('./wp-config.php'); 3 4 function login() { 5 global $wpdb, $log, $pwd, $error, $user_ID; 6 global $pass_is_md5; 7 $user_login = &$log; 8 $pwd = md5($pwd); 9 $password = &$pwd; 10 if (!$user_login) { 11 $error = __('<strong>Error</strong>: the login field is empty.'); 12 return false; 13 } 14 15 if (!$password) { 16 $error = __('<strong>Error</strong>: the password field is empty.'); 17 return false; 18 } 19 20 $query = "SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login' AND user_pass = '$password'"; 21 22 $login = $wpdb->get_row($query); 23 24 if (!$login) { 25 $error = __('<strong>Error</strong>: wrong login or password.'); 26 $pwd = ''; 27 return false; 28 } else { 29 $user_ID = $login->ID; 30 if (($pass_is_md5 == 0 && $login->user_login == $user_login && $login->user_pass == $password) || ($pass_is_md5 == 1 && $login->user_login == $user_login && $login->user_pass == md5($password))) { 31 return true; 32 } else { 33 $error = __('<strong>Error</strong>: wrong login or password.'); 34 $pwd = ''; 35 return false; 36 } 37 } 38 } 39 40 function checklogin() { 41 global $user_login, $user_pass_md5, $user_ID; 42 43 $userdata = get_userdatabylogin($user_login); 44 45 if ($user_pass_md5 != md5($userdata->user_pass)) { 46 return false; 47 } else { 48 return true; 49 } 50 } 3 51 4 52 if (!function_exists('add_magic_quotes')) { … … 73 121 if (0 == $user->user_level) { 74 122 $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; 75 }76 77 function login() {78 global $wpdb, $log, $pwd, $error, $user_ID;79 global $pass_is_md5;80 $user_login = &$log;81 $pwd = md5($pwd);82 $password = &$pwd;83 if (!$user_login) {84 $error = __('<strong>Error</strong>: the login field is empty.');85 return false;86 }87 88 if (!$password) {89 $error = __('<strong>Error</strong>: the password field is empty.');90 return false;91 }92 93 $query = "SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login' AND user_pass = '$password'";94 95 $login = $wpdb->get_row($query);96 97 if (!$login) {98 $error = __('<strong>Error</strong>: wrong login or password.');99 $pwd = '';100 return false;101 } else {102 $user_ID = $login->ID;103 if (($pass_is_md5 == 0 && $login->user_login == $user_login && $login->user_pass == $password) || ($pass_is_md5 == 1 && $login->user_login == $user_login && $login->user_pass == md5($password))) {104 return true;105 } else {106 $error = __('<strong>Error</strong>: wrong login or password.');107 $pwd = '';108 return false;109 }110 }111 123 } 112 124 … … 240 252 $user_pass_md5 = $_COOKIE['wordpresspass_'.$cookiehash]; 241 253 } 242 243 function checklogin() {244 global $user_login, $user_pass_md5, $user_ID;245 246 $userdata = get_userdatabylogin($user_login);247 248 if ($user_pass_md5 != md5($userdata->user_pass)) {249 return false;250 } else {251 return true;252 }253 }254 254 255 255 if ( !(checklogin()) ) {
Note: See TracChangeset
for help on using the changeset viewer.