| 93 | | case 'login': |
|---|
| 94 | | |
|---|
| 95 | | if( !empty($_POST) ) { |
|---|
| 96 | | $log = $_POST['log']; |
|---|
| 97 | | $pwd = $_POST['pwd']; |
|---|
| 98 | | $redirect_to = preg_replace('|[^a-z/.:_-]|i', '', $_POST['redirect_to']); |
|---|
| 99 | | } |
|---|
| 100 | | |
|---|
| 101 | | $user = get_userdatabylogin($log); |
|---|
| 102 | | |
|---|
| 103 | | if (0 == $user->user_level) { |
|---|
| 104 | | $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; |
|---|
| 105 | | } |
|---|
| 106 | | |
|---|
| 107 | | if ( !login($log, $pwd) ) { |
|---|
| 108 | | header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); |
|---|
| 109 | | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|---|
| 110 | | header('Cache-Control: no-cache, must-revalidate'); |
|---|
| 111 | | header('Pragma: no-cache'); |
|---|
| 112 | | if ($is_IIS) |
|---|
| 113 | | header('Refresh: 0;url=wp-login.php'); |
|---|
| 114 | | else |
|---|
| 115 | | header('Location: wp-login.php'); |
|---|
| 116 | | exit(); |
|---|
| 117 | | } else { |
|---|
| 118 | | $user_login = $log; |
|---|
| 119 | | $user_pass = md5($pwd); |
|---|
| 120 | | setcookie('wordpressuser_'.$cookiehash, $user_login, time() + 31536000, COOKIEPATH); |
|---|
| 121 | | setcookie('wordpresspass_'.$cookiehash, md5($user_pass), time() + 31536000, COOKIEPATH); |
|---|
| 122 | | |
|---|
| 123 | | header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); |
|---|
| 124 | | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|---|
| 125 | | header('Cache-Control: no-cache, must-revalidate'); |
|---|
| 126 | | header('Pragma: no-cache'); |
|---|
| 127 | | |
|---|
| 128 | | if ($is_IIS) |
|---|
| 129 | | header("Refresh: 0;url=$redirect_to"); |
|---|
| 130 | | else |
|---|
| 131 | | header("Location: $redirect_to"); |
|---|
| 132 | | } |
|---|
| 133 | | |
|---|
| 134 | | break; |
|---|
| 135 | | |
|---|
| 136 | | |
|---|
| | 169 | |
|---|
| | 170 | if( !empty($_POST) ) { |
|---|
| | 171 | $log = $_POST['log']; |
|---|
| | 172 | $pwd = $_POST['pwd']; |
|---|
| | 173 | $redirect_to = preg_replace('|[^a-z/.:_-]|i', '', $_POST['redirect_to']); |
|---|
| | 174 | } |
|---|
| | 175 | |
|---|
| | 176 | $user = get_userdatabylogin($log); |
|---|
| | 177 | |
|---|
| | 178 | if (0 == $user->user_level) { |
|---|
| | 179 | $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; |
|---|
| | 180 | } |
|---|
| | 181 | |
|---|
| | 182 | if ( !login($log, $pwd) ) { |
|---|
| | 183 | header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); |
|---|
| | 184 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|---|
| | 185 | header('Cache-Control: no-cache, must-revalidate'); |
|---|
| | 186 | header('Pragma: no-cache'); |
|---|
| | 187 | } else { |
|---|
| | 188 | $user_login = $log; |
|---|
| | 189 | $user_pass = md5($pwd); |
|---|
| | 190 | setcookie('wordpressuser_'.$cookiehash, $user_login, time() + 31536000, COOKIEPATH); |
|---|
| | 191 | setcookie('wordpresspass_'.$cookiehash, md5($user_pass), time() + 31536000, COOKIEPATH); |
|---|
| | 192 | |
|---|
| | 193 | header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); |
|---|
| | 194 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|---|
| | 195 | header('Cache-Control: no-cache, must-revalidate'); |
|---|
| | 196 | header('Pragma: no-cache'); |
|---|
| | 197 | |
|---|
| | 198 | if ($is_IIS) |
|---|
| | 199 | header("Refresh: 0;url=$redirect_to"); |
|---|
| | 200 | else |
|---|
| | 201 | header("Location: $redirect_to"); |
|---|
| | 202 | } |
|---|