<?php session_start();include('conn.php');header("content-type:text/html;charset=utf-8"); if (isset($_POST['apply'])){ $user=$_POST['user']; $password=$_POST['word']; if($_POST['check']==$_SESSION['checkpic']){ echo "<SCRIPT language=javascript> function CheckPost() if (myform.user.value.length<2){ alert('用户名不能小于两个字符'); myform.user.focus(); return false;} if (myform.word.value.length<6){ alert('密码不能少于6位'); myform.content.focus(); return false;} </SCRIPT>"; $sql = "select username from user where username = '$password'"; //SQL语句 $result = mysql_query($sql); //执行SQL语句 $num = mysql_num_rows($result); //统计执行结果影响的行数 if($num){ echo "<script>alert('用户名已存在')</script>"; } else{ $sql1="INSERT INTO `user`(`id`, `user`, `password`) VALUES ('','$user','$password')";//插入用户信息 $result=mysql_query($sql1); IF($result){ echo "<script>alert('注册成功!')</script>"; } } } else { echo "<script>alert('验证码错误')</script>"; } }?>
添加回答
举报
0/150
提交
取消