+ 10
How do you create log in form in html
3 ответов
+ 7
thanks
+ 3
Html
<form action="login.php">
<input name="username">
<input type="password" name="password">
<input type="submit" name="loginsubmit">
</form>
login.php
<?php
session_start ();
if (isset ($_POST ['loginsubmit'])){
$db = mysqli_connect (localhost, $dbusername, $dbpassword, $dbname);
$username = $_POST ['username'];
$password = $_POST ['password'];
$check = "SELECT * FROM users WHERE username='$username'";
$checksql = mysqli_query ($db, $check);
$row = mysqli_fetch_assoc ($checksql);
//password check
$checkpass = password_verify ($password, $);
if ($checkpass === true){
//login to user
$_SESSION ['username'] = $username;
}
}