|
- <?php
- /*
- Author:ZSQ
- Compeny:Spiders Travel
- */
- require_once '../st-xm/Common/Mysql.php';
- header("Access-Control-Allow-Origin:*");
- //test
- //$_POST['user_name'] = "test001";
- //$_POST['user_psd'] = "test001";
- //end of test
-
-
- $user_name=isset($_POST['user_name'])? $_POST['user_name']:false;
- $user_psd=isset($_POST['user_psd'])? $_POST['user_psd']:false;
-
- $return_data = array();
- $return_data['code']='201';
-
- if( $user_name == false || $user_psd == false ) {
- $return_data['code']='401';
- echo json_encode($return_data);
- exit();
- }
- $pdo=conn();
- $sql=" SELECT user_name,user_psd,user_auth_code FROM api_auth_code WHERE user_name='".$_POST['user_name']."' AND user_psd='".$_POST['user_psd']."' ";
-
- $result=$pdo->query($sql);
- $rowset=$result->fetchAll();
- if( false == $rowset ) {
- $return_data['code']='402';
- echo json_encode($return_data);
- exit();
- }
-
- $return_data['code']='201';
- $return_data['auth_code']=$rowset[0]["user_auth_code"];
-
- echo json_encode($return_data);
- exit();
|