Xữ lý đăng nhập có session trong PHP
<?php
include("connection.php");
$us = $_POST['us'];
$pa = md5($_POST['pa']);
$sq="select * from customer where username='$us' and password='$pa'";
$result = mysql_query($sq);
if(mysql_num_rows($result)>0)
{
$_SESSION['user']=$us;
echo "<script>alert('Login is successful!')</script>";
echo '<meta http-equiv="REFRESH" content ="0;URL=doimatkhau.php"/>';
}
else
{
echo "<script>alert('Login is not successful!')</script>";
echo '<meta http-equiv="REFRESH" content ="0;URL=formdn_ss.php"/>';
}
?>