Registration processing page
李文俊&
李文俊& 2018-02-21 15:17:59
0
3
1113

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

李文俊&
李文俊&

reply all(2)
李文俊&

means the verification code is wrong.

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

  • reply <?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>"; } } ?>
    王承毅 author 2018-04-21 15:04:36
lge

What error are you reporting?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!