\n"; $errors = $newerrors; } echo '
' . apply_filters('login_errors', $errors) . "
\n"; } } // End of login_header() switch ($action) { case 'logout' : wp_clearcookie(); do_action('wp_logout'); $redirect_to = _get_wap_home() . '/login.php?loggedout=true'; //echo $redirect_to; //wp_safe_redirect($redirect_to); wp_redirect($redirect_to, 302); exit(); break; case 'login' : default: $user_login = ''; $user_pass = ''; $using_cookie = FALSE; $redirect_to = _get_wap_home() . '/writer.php'; if ( !isset( $_REQUEST['redirect_to'] ) || is_user_logged_in() ) $redirect_to = _get_wap_home() . '/writer.php'; else $redirect_to = $_REQUEST['redirect_to']; if ( $_POST ) { $user_login = $_POST['log']; $user_login = sanitize_user( $user_login ); $user_pass = $_POST['pwd']; $rememberme = $_POST['rememberme']; } else { $cookie_login = wp_get_cookie_login(); if ( ! empty($cookie_login) ) { $using_cookie = true; $user_login = $cookie_login['login']; $user_pass = $cookie_login['password']; } } do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass)); // If cookies are disabled we can't log in even with a valid user+pass if ( $_POST && empty($_COOKIE[TEST_COOKIE]) ) $errors['test_cookie'] = __('ERROR: WordPress requires Cookies but your browser does not support them or they are blocked.'); if ( $user_login && $user_pass && empty( $errors ) ) { $user = new WP_User(0, $user_login); // If the user can't edit posts, send them to their profile. if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) ) $redirect_to = _get_wap_home() . '/writer.php'; if ( wp_login($user_login, $user_pass, $using_cookie) ) { if ( !$using_cookie ) wp_setcookie($user_login, $user_pass, false, '', '', $rememberme); do_action('wp_login', $user_login); wp_redirect($redirect_to, 302); exit(); } else { if ( $using_cookie ) $errors['expiredsession'] = __('Your session has expired.'); } } if ( $_POST && empty( $user_login ) ) $errors['user_login'] = __('ERROR: The username field is empty.'); if ( $_POST && empty( $user_pass ) ) $errors['user_pass'] = __('ERROR: The password field is empty.'); // Some parts of this script use the main login form to display a message if ( TRUE == $_GET['loggedout'] ) $errors['loggedout'] = __('Successfully logged you out.','wap'); elseif ( 'disabled' == $_GET['registration'] ) $errors['registerdiabled'] = __('User registration is currently not allowed.','wap'); elseif ( 'confirm' == $_GET['checkemail'] ) $errors['confirm'] = __('Check your e-mail for the confirmation link.','wap'); elseif ( 'newpass' == $_GET['checkemail'] ) $errors['newpass'] = __('Check your e-mail for your new password.','wap'); elseif ( 'registered' == $_GET['checkemail'] ) $errors['registered'] = __('Registration complete. Please check your e-mail.','wap'); login_header(__('Login','wap')); ?>