shaoguo 7 місяців тому
батько
коміт
b36c251c23
2 змінених файлів з 5 додано та 3 видалено
  1. BIN
      hua_fei/config/huafei.sqlite3
  2. 5 3
      hua_fei/register.php

BIN
hua_fei/config/huafei.sqlite3


+ 5 - 3
hua_fei/register.php

@@ -6,9 +6,11 @@ if($method_type=="post"){
     $phone=$_POST['phone'];
     $password=$_POST['pass'];
     $time=date("Y-m-d H:i:s");
-    $user_stmit=$pdo->query("select * from users where `phone`=".$phone .' limit 1');
+    $user_stmit=$pdo->query("select * from users where `phone`='".$phone."'".' limit 1');
+
     $user=$user_stmit->fetch(PDO::FETCH_ASSOC);
-    if(empty($user))exit(json_encode(['code'=>0,"msg"=>"改手机号已存在"]));
+
+    if(!empty($user))exit(json_encode(['code'=>0,"msg"=>"改手机号已存在"]));
     $stmit=$pdo->prepare("insert into users(`phone`,`password`,`created_at`, `updated_at`)values(?,?,?,?)");
     $stmit->execute(array($phone,$password,$time,$time));
     $id=$pdo->lastInsertId();
@@ -108,7 +110,7 @@ if($method_type=="post"){
             } else {
                 if (data.code == 1) {
                     layer.msg(data.msg, {time:2000,shift: 6 }, function () {
-                         window.location.href = "/recharge.html";
+                         window.location.href = "/home";
                     });
                 }
             }