คือผมติดปัญหาที่ว่าผมจะดึงเอาข้อมูลจากฐานของมูลของ register ออกมาให้มันล๊อคอิน แต่เวลาล๊อคอิน มันล๊อคอินไม่ไปอะคับทั้งที่พาสถูกหมด user ก็ถูก แต่มันก็บอกผิดเรื่อยเลยอะคับ ผมควรจะทำยังไงดีอ่าคับ ยังไงก็ช่วยแนะนำให้ทีนะคับ อันนี้เป็น CODE ของหน้า login กับ หน้า chakuser นะคับ
login.php Code<?
session_start();
ob_start();
?>
<!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">
<style type="text/css">
<!--
.VVF {
color: #FFF;
font-weight: bold;
font-size: 12px;
}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>สมาชิกเข้าสู่ระบบ</title>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
body {
background-image: url(bg2.jpg);
font-size: 12px;
color: #666;
text-align: center;
}
.style2 {color: red; font-weight: bold;}
.style8 {
color: #FFFFFF;
font-weight: bold;
text-align: center;
}
.BG {
font-weight: bold;
}
.BG {
color: #F00;
}
.BG {
color: #FFF;
}
-->
</style></head>
<body bgcolor="#FFFFFF">
<p><br>
<br><br>
</p>
<form name="form1" method="post" action="chackuser.php">
<table width="268" border="1" align="center" cellpadding="0">
<tr>
<td width="112" class="style8">Username :</td>
<td width="144"><input type="text" name="userid" id="userid"></td>
</tr>
<tr>
<td class="style8">Password :</td>
<td><input type="password" name="password" id="password"></td>
</tr>
<td colspan="2" align="center" class="style8">Login ตลอดไป :
<input name="check" type="checkbox" id="check" value="on" /></td>
<tr>
<td colspan="2" align="center"><div align="center">
<p class="VVF"><a href="
http://ts-inter.siam.im/register/register.php">สมัครสมาชิก</a> /<a href="#"> ลืมรหัสผ่าน</a></p>
<p>
<input type="submit" name="Submit" value="Login">
</p>
</div></td>
</tr>
</table>
<div align="center"><? print"$code_error";?></div>
</form>
<p class="BG">*ท่านไม่ต้องแปลกใจ หากเข้าสู่ระบบไม่ได้ สาเหตุหลักๆมาจาก </p>
<p class="BG">1.ท่านกรอก การสมัครมั่ว ซึ้งทางทีมงานจะตรวจสอบตลอด 24 หากพบผู้กรอกข้อมูลมั่ว ทางทีมงาน จะทำการบล๊อค Usename และ Password ของท่านโดยทันที</p>
<p class="BG">หากมีปัญหาในการล๊อคอิน โปรดแจ้งเรื่องมาได้ที่ E-mail : <a href="
snowbrod2@hotmail.com">
snowbrod2@hotmail.com</a> หรือ ส่งเรื่อง พร้อมหลักฐานมาที่ E-mail: <a href="
tsinter@admin.in.th">
tsinter@admin.in.th </a> ทางทีมงานจะดำเนินการภายใน 24 ชั่วโมง</p>
<p class="BG">ขอขอบคุณทุกท่านคับ</p>
<hr />
<table width="968" border="0" align="center">
<tr>
<td width="962" align="center"><span class="BN">
<p>Power By.SnowBrod © Copyright 2011. All rights Reserved .ทีมงาน Ts-inter ขอสงวนลิขสิทธิ์ในการแก้ไขข้อมูลต่างๆ<br />
<a href="
http://www.tsinterserver.ob.tc/Home.html">www.tsinter.tk</a> </p>
<script type="text/javascript" language="JavaScript1.1" src="
http://tracker.stats.in.th/tracker.php?uid=27090"></script>
<noscript>
<a target="_blank" href="
http://www.stats.in.th/">www.Stats.in.th</a>
</noscript>
</p>
</p>
</span></td>
</tr>
</table>
</body>
</html>
ส่วนตรงนี้เป็นของหน้า
Chackuser.php <?
session_start();
ob_start();
?>
<!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>ChackFrom...</title>
</head>
<body><?
//เริ่มติดต่อฐานข้อมูล
mysql_connect("localhost","root","1234");
// เลือกฐานข้อมูล
mysql_select_db("register");
// คำสั่ง SQL และสั่งให้ทำงาน
$sql = "select * from member where userid='$userid' and password='$password'"; //เช็คค่าข้อมูลที่ส่งมาจากฟอร์ม
$dbquery = mysql_db_query($dbname, $sql);
// หาจำนวนเรกคอร์ดข้อมูล
$num_rows = mysql_num_rows($dbquery);
if($num_rows == 1)
{
if($check == "on")
{
setcookie("userid",$username,time()+3600*24*356);
setcookie("password",$password,time()+3600*24*356);
header("location:http://www.tsinterserver.ob.tc/Home.html"); //ไปตามหน้าที่คุณต้องการ
} else {
header("location:http://www.tsinterserver.ob.tc/Home.html"); //ไปตามหน้าที่คุณต้องการ
}
} else {
$code_error="<span class=style2> ข้อมูลไม่ถูกต้องกรุณา Login ใหม่</span> ";
session_register("code_error");
header("location:login.php");//ถ้า username และ รหัสผ่าน ไม่ตรงกันให้กลับไปหน้าล๊อคอินอีกครั้ง
}
?>
ส่วนตรงนี้เป็นหน้าของ ฐานข้อมูลที่จะให้ดึงข้อมูลมาคับ
Sql CREATE TABLE `member` (
`id_member` int(5) NOT NULL auto_increment,
`userid` varchar(20) NOT NULL,
`password` varchar(15) NOT NULL,
`email` varchar(30) NOT NULL,
`name` varchar(30) NOT NULL,
`sex` varchar(10) NOT NULL,
`age` varchar(10) NOT NULL,
`addss` varchar(60) NOT NULL,
`tel` varchar(30) NOT NULL,
`w_web` varchar(20) NOT NULL,
PRIMARY KEY (`id_member`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- dump ตาราง `member`
--
INSERT INTO `member` (`id_member`, `userid`, `password`, `email`, `name`, `sex`, `age`, `addss`, `tel`, `w_web`) VALUES
(1, 'snowbrod', '1234', '
snowbrod@gmail.com', 'นพรัตน์', 'ชาย', '21', '143/1 ถ.พะเยา-ป่าแดด อ.เมือง จ.พะเยา', '', '
www.tsinter.tk');
ยังไงก็ช่วยดูให้ทีนะคับ ขอบคุณมากคับ