create login php mysql code example
Example 1: login php
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
</head>
<body>
<form action="" method="POST">
<input type="password" name="password">
<button type="submit" name="submit">Login</button>
</form>
<?php
if(isset($_POST['submit'])){
if(password_verify($_POST['password'], '$2y$10$sejeRNYZGaoPh1EwfcuO1.hxl/uepQOh9SITWWgeej86vnMt26KIa')){
$_SESSION['login'] = true;
header("Location: http://localhost");
}
}
?>
</body>
</html>
Example 2: php login
<form method="post" action="ope.php" id="formlogin" name="formlogin" >
<fieldset id="fie">
<legend>LOGIN</legend><br />
<label>NOME : </label>
<input type="text" name="login" id="login" /><br />
<label>SENHA :</label>
<input type="password" name="senha" id="senha" /><br />
<input type="submit" value="LOGAR " />
</fieldset>
</form>