<?php
if(isset($_POST['username']) && isset($_POST['login'])){
$connect= mysql_connect("localhost","root") or die(mysql_error());
mysql_select_db("register");
$username=$_POST['username'];
$login=$_POST['login'];
$password=$_POST['password'];
$r_password=$_POST['r_password'];
if($password==$r_password) {
die("<h1>Registration is successful<h1>");
$query=mysql_query("INSERT INTO users (`username`, `login`, `password`) VALUES('$username', '$login', '$password')")or die(mysql_error());
}
else{
die("<h1>Password must match<h1>");
}
}
if (isset($_POST['enter'])){
$e_login=$_POST['e_login'];
$e_password=$POST['e_password'];
$query=mysql_query("SELECT * FROM users WHERE login='$e_login");
$user_data=mysql_fetch_array($query);
if($user_data['password'] == $e_password){
echo "osdfgk";
}
else{
echo"wrong password or login";
}
}
?>
<form method="post" action ="register.php">
<input type="text"name="username" placeholder="Username" required /><br>
<input type="text"name="login"placeholder="Login" required /> <br>
<input type="password"name="password"placeholder="Password" required /> <br>
<input type="password"name="r_password"placeholder="Repeat password" required /> <br>
<input type="submit" name="submit" value="register"/>
</form>
<form method="post" action ="register.php">
<input type="text"name="e_login"placeholder="Login" required /> <br>
<input type="password"name="e_password"placeholder="Password" required /> <br>
<input type="submit" name="enter" value="Enter"/>
</form>