gianghl1983
5/21/2018 - 3:36 PM

Session New - Khoi tao session

<?php
session_start();//khoi tao phien lam viec
$_username = 'admin';//Querry from MySQL...
$_password = 'admin';

echo 'Hay dang nhap de lam bai kiem tra';
if(isset($_POST['submit'])) {
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    if ( $username == $_username && $password == $_password ) {
        $_SESSION['login'] = ['username' => $username, 'password' => $password];
        header ('Location: tracnghiem.php');
        exit;//khong thuc thi tiep code ben duoi
    }


}