登録の検証が失敗し続けます
<?php<br /> require_once 'db.php'; <br /> session_start();<br /> <br /> $name = $_POST["name"] ;<br /> $mail = $_POST["email"] ;<br /> $pwd= $_POST["key"] ;<br /> $pwd2 = $_POST["rekey"] ;<br /> $agreement = $_POST["agreement"] ;<br /> <br /> <br /> if($agreement=="T"){<br /> if($pwd==$pwd2){<br /> $sql="select * from user";<br /> $result = $db->query($sql); <br /> if($result && $row=$result->fetch_assoc()){<br /> if($name==$row["name"]){<br /> echo '<script>';<br /> echo "alert('用户已存在');";<br /> echo "window.location='enroll.html'";<br /> echo "</script>";<br /> exit;<br /> }elseif($mail==$row["mail"]){<br /> echo '<script>';<br /> echo "alert('该邮箱已使用');";<br /> echo "window.location='enroll.html'";<br /> echo "</script>";<br /> exit;<br /> }else{<br /> $sql="insert into user(name,represent,pwd,mail,time) value('{$name}',0,'{$pwd}','{$mail}',now())";<br /> $result = $db->query($sql);<br /> if($result && $db->affected_rows>0){<br /> $sql="select * from user where name='{$name}'";<br /> $result = $db->query($sql);<br /> if($result && $row=$result->fetch_assoc()){<br /> $uid=$row['uid'];<br /> }<br /> } <br /> $result->free_result;<br /> $db->close; <br /> <br /> $sql="insert into userphoto(uid,name,type,url,size,time) value('{$uid}','steve','.png','./img/userphoto/steve.png','6.24kb',now())";<br /> $result = $db->query($sql);<br /> if($result && $db->affected_rows>0){<br /> echo '<script>';<br /> echo "alert('注册成功');";<br /> echo "window.location='index.php'";<br /> echo "</script>";<br /> exit;<br /> }else{<br /> echo '<script>';<br /> echo "alert('注册失败');";<br /> echo "window.location='enroll.html'";<br /> echo "</script>";<br /> exit;<br /> }<br /> }<br /> }<br /> $result->free_result;<br /> $db->close; <br /> }else{<br /> echo '<script>';<br /> echo "alert('密码不一致,请重新输入');";<br /> echo "window.location='enroll.html'";<br /> echo "</script>";<br /> exit;<br /> }<br /> }else{<br /> echo '<script>';<br /> echo "alert('未同意协议,注册失败');";<br /> echo "window.location='enroll.html'";<br /> echo "</script>";<br /> exit;<br /> } <br /> $result->free_result;<br /> $db->close;<br />?>