ob_start();
session_start();
?>
// error_reporting(E_ALL);
// ini_set("display_errors", 1);
?>
Tutorialspoint.com
Enter Username and Password
$msg = '';
if (isset($_POST['login']) && !empty($_POST['username'])
&& !empty($_POST['password'])) {
if ($_POST['username'] == 'tutorialspoint' &&
$_POST['password'] == '1234') {
$_SESSION['valid'] = true;
$_SESSION['timeout'] = time();
$_SESSION['username'] = 'tutorialspoint';
echo 'You have entered valid use name and password';
}else {
$msg = 'Wrong username or password';
}
}
?>
action = " ?>" method = "post">
name = "username" placeholder = "username = tutorialspoint"
required autofocus>
name = "password" placeholder = "password = 1234" required>
name = "login">Login
Click here to clean Session.
Logout.php
session_start();
unset($_SESSION["username"]);
unset($_SESSION["password"]);
echo 'You have cleaned session';
header('Refresh: 2; URL = login.php');
?>
Kaynak: https://www.tutorialspoint.com/php/php_login_example.htm
Bu da sizin istediğiniz;
https://www.tutorialspoint.com/php/php_mysql_login.htm