You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
991 B

  1. <?php
  2. /*
  3. Author:ZSQ
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../st-xm/Common/Mysql.php';
  7. header("Access-Control-Allow-Origin:*");
  8. //test
  9. //$_POST['user_name'] = "test001";
  10. //$_POST['user_psd'] = "test001";
  11. //end of test
  12. $user_name=isset($_POST['user_name'])? $_POST['user_name']:false;
  13. $user_psd=isset($_POST['user_psd'])? $_POST['user_psd']:false;
  14. $return_data = array();
  15. $return_data['code']='201';
  16. if( $user_name == false || $user_psd == false ) {
  17. $return_data['code']='401';
  18. echo json_encode($return_data);
  19. exit();
  20. }
  21. $pdo=conn();
  22. $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']."' ";
  23. $result=$pdo->query($sql);
  24. $rowset=$result->fetchAll();
  25. if( false == $rowset ) {
  26. $return_data['code']='402';
  27. echo json_encode($return_data);
  28. exit();
  29. }
  30. $return_data['code']='201';
  31. $return_data['auth_code']=$rowset[0]["user_auth_code"];
  32. echo json_encode($return_data);
  33. exit();