-2
작동하지 않습니다하지만 난 사용자 등록 양식을 할 필요가 있고 이것은 내가 천국은 내가 "라는 메시지를 볼 수 있습니다 지금까지삽입 내가 PHP와 좋은 아니에요
<!doctype html>
<html>
<head>
<title>Register</title>
</head>
<body>
<p><a href="register.php">Register</a> | <a href="login.php">Login</a></p>
<h3>Formulario de registro</h3>
<form action="" method="POST">
Usuario: <input type="text" name="login"><br />
Contrasena: <input type="password" name="password"><br />
Email: <input type="text" name="email"><br />
Sexo: <input type="text" name="sex"><br />
Edad: <input type="text" name="age"><br />
Telefono: <input type="text" name="phone"><br />
Pais: <input type="text" name="country"><br />
Ciudad: <input type="text" name="city"><br />
Direccion: <input type="text" name="address"><br />
<input type="submit" value="Register" name="submit" />
</form>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['login']) && !empty($_POST['password'])) {
$login=$_POST['login'];
$password=$_POST['password'];
$email=$_POST['email'];
$sex=$_POST['sex'];
$age=$_POST['age'];
$phone=$_POST['phone'];
$country=$_POST['country'];
$city=$_POST['city'];
$address=$_POST['address'];
$con=mysqli_connect('localhost','root','','registro_usuarios') or die(mysql_error());
$sql="SELECT * FROM usuario ";
$result = mysqli_query($con,$sql);
if(mysqli_num_rows($result)>=0)
{
echo "I'm in";
$sql="INSERT INTO usuario (login,password,email,sex,age,phone,country,city,address)
VALUES('$login','$password','$password','$email','$sex','$age','$country','$city','$address')";
$result=mysqli_query($con,$sql);
if($result){
echo "Account Successfully Created";
} else {
echo "Failure!";
}
} else {
echo "That username already exists! Please try again with another.";
}
} else {
echo "All fields are required!";
}
}
?>
</body>
</html>
를 할 것입니다 내 화면에서 'm in'하지만 데이터베이스에 아무 것도 삽입하지 않기 때문에 "실패"메시지가 나타납니다. 나는 그 오류를 찾으려 고 노력했지만 지금까지 아무 것도하지 않았습니다. 이 오류는 주변
$sql="INSERT INTO usuario (login,password,email,sex,age,phone,country,city,address)
VALUES('$login','$password','$password','$email','$sex','$age','$country','$city','$address')";
$result=mysqli_query($con,$sql);
나는 너희들이 궁금에는 오타가없는 경우를 대비 오타의 경우 내 데이터베이스에서 모든 값을 확인했다이어야한다.
감사합니다.
고맙게도 :
오류가 계속되면, 당신은이 쿼리에 무엇을 잘못 알고 추가 할 수 있습니다 /www.owasp.org/index.php/SQL_Injection)! – BenM
이 줄 바꿈 ('$ 로그인', '$ 비밀번호', '$ 이메일', '$ 연령', '$ 전화', '$ 국가', '$ 도시', '$ 주소 ') "; 나는 값 암호를 두 번 썼지 만 여전히 아무것도하지 않았다. –
'$ phone'은 무엇인가? – BenM