php - Sign in to wordpress from iPhone app -


i creating iphone app wordpress membership site. in app user faces log in screen enter username , password , these sent via post external php page store on server.

what trying check user's credentials in external php page. if user registered on wp database , has entered right credentials, send 'success' response, otherwise nothing.

my problem not working. using wp_signon function reason is_wp_error($user_verify) keeps returning 1. here code far, appreciate help.

<?php $parse_uri = explode('apple', $_server['script_filename']); //makes page part of wordpress $wp_load = $parse_uri[0].'wp-load.php'; require_once($wp_load); global $wpdb; global $current_user;  //####### code responsible secure log in iphone app ############# header('content-type: application/json'); //matches json content type app expecting  //sql escape inputs   $username = $wpdb->escape($_post['username']);   $password = $wpdb->escape($_post['password']);     $login_data = array();    $login_data['user_login'] = $username;    $login_data['user_password'] = $password;    $login_data['remember'] = true;  $user_verify = wp_signon( $login_data, true);     if (is_wp_error($user_verify) )    {    //deny access : failure   exit();    } else  { //$user_verify contains wp_user object   //grant access : success  echo '[{"success":"true"}]';  exit();    }    ?> 

update

after testing, code provided above functional, problem on ios side.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -