search

Home  >  Q&A  >  body text

Registration processing page

Follow this and find that the verification code module on the registration page prompts an error. . . .

李文俊&李文俊&2528 days ago1163

reply all(3)I'll reply

  • 李文俊&

    李文俊&2018-02-22 15:58:48

    means the verification code is wrong.

    Ha ha. I found the problem and I wrote the wrong code.

    reply
    0
  • 王承毅

    <?php //Start session session session_start(); header('content-type:text/html;charset=utf-8'); //Receive form data $username=trim($_POST['username']); $password=md5(trim($_POST['password'])); //Password MD5 encryption $password_confirm=md5(trim($_POST['password'])); $code=$_POST['code']; if($username==''||$password==''||$password_confirm==''){ echo "<script>alert('Please make sure the information is complete!');history.back();</script>"; }elseif($code!=$_SESSION['var_code']){ echo "<script>alert('The verification code is incorrect!');history.back();</script>"; }else{ if($password==$password_confirm){ //2. Connect to MYSQL and select the database $link = mysql_connect('localhost','root','root') or die("Database connection failed!"); mysql_query('set names utf8'); mysql_query('use `demodb`'); //Execute sql $sql="select * from `manager` where `username`='$username'"; $res=mysql_query($link,$sql); $nums=mysql_num_rows($res); if($nums){ //Exists echo "<script> alert('Username already exists, please change it!');history.back();</script>"; exit; }else{ $sql_insert="insert into manager values('$username','$password')"; $res_insert=mysql_query($link,$sql_insert); if($res_insert){ echo "<script>alert('Registration successful!');history.back();</script>"; }else{ echo "<script>alert('Registration failed!');history.back();</script>"; } } } else{ echo "<script>alert('Passwords are inconsistent!');history.back();</script>"; } } ?>

    王承毅 · 2018-04-21 15:04:36
  • 韦小宝

    韦小宝2018-02-22 10:19:10

    What error are you reporting?

    reply
    0
  • Cancelreply