Mã nguồn PHP:
[COLOR=#007700]);
else
{
[/COLOR][COLOR=#0000BB]?>
[/COLOR]<form action=home.php?go=XuLy_Login method=post>
<p align="center" >Đăng nhập </p>
<p align="center">Username:</p>
<p align="center">
<input type=text name=username size=25 />
Password:</p>
<p align="center">
<input type=password name=password size=25 />
</p>
<p align="center">
<input type=submit name=ok value="Đăng nhập" />
<label>
<input type="submit" name="Submit" value="Reset" />
</label>
</p>
</form>
[COLOR=#0000BB]<?
[/COLOR][COLOR=#007700]}
[/COLOR][COLOR=#0000BB]?>
[/COLOR]
Còn trang xử lý login như thế này:
Mã nguồn PHP:
[COLOR=#000000]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
[/COLOR][COLOR=#007700]require ([/COLOR][COLOR=#DD0000]"KetNoiCSDL.php"[/COLOR][COLOR=#007700]);
[/COLOR][COLOR=#0000BB]$username[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'username'[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000BB]$password [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]md5[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'password'[/COLOR][COLOR=#007700]]);
[/COLOR][COLOR=#0000BB]$sql[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"SELECT * FROM Customer WHERE CustUser='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$username[/COLOR][COLOR=#007700].[/COLOR][COLOR=#DD0000]"' and CustPass='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$password[/COLOR][COLOR=#007700].[/COLOR][COLOR=#DD0000]"'"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000BB]$result[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sql[/COLOR][COLOR=#007700]);
echo ([/COLOR][COLOR=#0000BB]$result[/COLOR][COLOR=#007700]);
[/COLOR][COLOR=#0000BB]$count[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]mysql_num_rows[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$result[/COLOR][COLOR=#007700]);
if([/COLOR][COLOR=#0000BB]$count[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]){
[/COLOR][COLOR=#0000BB]session_start[/COLOR][COLOR=#007700]();
[/COLOR][COLOR=#0000BB]$_SESSION[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'flaglogin'[/COLOR][COLOR=#007700]] = [/COLOR][COLOR=#0000BB]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'CustUser'[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000BB]header[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"location:home.php?go=login_success"[/COLOR][COLOR=#007700]);
}
else {
echo [/COLOR][COLOR=#DD0000]"Wrong user or password"[/COLOR][COLOR=#007700];
}
[/COLOR][COLOR=#0000BB]?>
[/COLOR]
</body>
Rõ ràng trong KetNoiCSDL.php của em đúng tên db, đúng tài khoản đăng nhập, chọn đúng db luôn (Code trang đăng ký chạy bt) mà ko hiểu sao khi click login nó hiện lỗi:
Mã:
Resource id #9
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\home.php:11) in C:\AppServ\www\Include\XuLy_Login.php on line 21
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\home.php:11) in C:\AppServ\www\Include\XuLy_Login.php on line 23
Cái resource id #9 đầu tiên đấy là kết quả của câu lệnh echo ("$result");
Theo điều tra tình hình sử dụng thuốc lá ở người trưởng thành năm 2020 do Bộ Y tế triển khai, ngày nay tỷ lệ đàn ông Việt Nam hút thuốc đang ở mức 42,3%. Không chỉ có khả năng gây ung thư và một...
Những thói quen khiến "cuộc vui" của hai người trở nên... dở dang