java– 用户注册页面未验证

java– 用户注册页面未验证,第1张

概述<?php $name=$_POST["name"];$age=$_POST["age"];$email=$_POST["email"];$password=$_POST["password"];$statement=mysqli_prepare($db,"INSERTINTOuser_info(name,a

<?PHP    	           $name = $_POST["name"];    $age = $_POST["age"];    $email = $_POST["email"];    $password =$_POST["password"];    $statement = MysqLi_prepare($db, "INSERT INTO user_info(name,age,email,password)     VALUES    (?,?,?,?)");      MysqLi_stmt_bind_param($statement, "siss", $name, $age, $email, $password);    MysqLi_stmt_execute($statement);           if($statement>0){               $response["success"] = 1;             }             else{               $response["success"] = 0;             }                 echo Json_encode($response);    ?>

我的用户注册页面不想验证.请建议PHP文本文件和androID端之间编码的哪一方验证将允许验证.请进一步协助,这是代码.

@OverrIDeprotected voID onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentVIEw(R.layout.activity_register);final EditText name = (EditText) findVIEwByID(R.ID.edtname);final EditText Age = (EditText) findVIEwByID(R.ID.edtAge);final EditText Email = (EditText) findVIEwByID(R.ID.edtUsername);final EditText Password = (EditText) findVIEwByID(R.ID.edtPassword);final Imagebutton valIDate = (Imagebutton) findVIEwByID(R.ID.btnReg);valIDate.setonClickListener(new VIEw.OnClickListener() {@OverrIDepublic voID onClick(VIEw v) {final int age = Integer.parseInt(Age.getText().toString());final String name = name.getText().toString();final String email = Email.getText().toString();final String password = Password.getText().toString();name.setText("");Age.setText("");Email.setText("");Password.setText("");                                                                         Response.Listener<String>responseListener=new                                    Response.Listener<String>() {@OverrIDepublic voID onResponse(String response) {try {JsONObject JsonResponse = new JsONObject(response);boolean success = JsonResponse.getBoolean("success");if (success) {Intent intent = new Intent(Register.this, Login.class);Register.this.startActivity(intent);} else {AlertDialog.Builder builder = new AlertDialog.Builder(Register.this);builder.setMessage("Register Failed").setNegativebutton("Retry", null).create().show();}} catch (JsONException e) {e.printstacktrace();}}};RegisterRequest registerRequest = new RegisterRequest(name, age, email,  password, responseListener);RequestQueue queue = Volley.newRequestQueue(Register.this);queue.add(registerRequest);}});}public voID extBtn(VIEw vIEw) {Intent intent = new Intent(this, MainActivity.class);startActivity(intent);}}

解决方法:

尝试使用这部分代码:

$bind = MysqLi_stmt_bind_param($statement, "siss", $name, $age, $email, $password);$execute = $bind->MysqLi_stmt_execute($bind); if(count($execute) > 0){     $response["success"] = 1; } else{     $response["success"] = 0; }        echo Json_encode($response);

计数是计算数据库中的行.

总结

以上是内存溢出为你收集整理的java – 用户注册页面未验证全部内容,希望文章能够帮你解决java – 用户注册页面未验证所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1119877.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存