1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<?php require ("../wp-load.php"); if($_REQUEST['pass'] != "" && $_REQUEST['email'] != "") { $ar = wp_authenticate_username_password("", $_REQUEST['email'], $_REQUEST['pass']); $class_name = get_class ($ar); if ( $class_name == "WP_User" ) { $user_id = $ar->data->ID; $arr = array( "id" => $user_id, "email" => $ar->data->user_email, "name" => $ar->data->display_name, ); $ar = array ("result" => 0, "message" => $arr); echo json_encode($ar); exit(); } else { $ar = array ("result" => 0, "message" => "Email or Password is Wrong"); echo json_encode($ar); exit(); } } else { $ar = array ("result" => 0, "message" => "Require Field Missing"); echo json_encode($ar); exit(); } ?> |
Leave a reply