Fatal error: Call to a member function escape() on a non-object in .....on line 10
- by danyo
i am making a simple javascript login form for wordpress. i have the form submitting to the following bit of php to handle the login:
<?php
get_header();
global $user_ID;
if (!$user_ID) {
if($_POST){
//We shall SQL escape all inputs
$username = $wpdb->escape($_REQUEST['username']);
$password = $wpdb->escape($_REQUEST['password']);
$remember = $wpdb->escape($_REQUEST['rememberme']);
if($remember) $remember = "true";
else $remember = "false";
$login_data = array();
$login_data['user_login'] = $username;
$login_data['user_password'] = $password;
$login_data['remember'] = $remember;
$user_verify = wp_signon( $login_data, false );
//wp_signon is a wordpress function which authenticates a user. It accepts user info parameters as an array.
if ( is_wp_error($user_verify) )
{
echo "<span class='error'>Invalid username or password. Please try again!</span>";
exit();
} else
{
echo "<script type='text/javascript'>window.location='". get_bloginfo('url') ."'</script>";
exit();
}
} else {
//get_header();
?>
any ideas on why i am getting the error?
Cheers, Dan