|
|
|
รบกวนพี่ๆดู code login ให้ทีครับ รบกวนพี่ๆอีกแล้วครับ ปัญหาที่พบ คือ พอsubmit แล้วมัน เด้งกัลบมาที่หน้า |
|
|
|
|
|
|
|
ลองดูน่ะครับ ตัวอย่างของผม เพื่อจะมีประโยชน์บ้าง
Code (PHP)
<?session_start();?>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>ระบบจองห้องประชุม สำนักงานจังหวัดลำปาง</title>
<?
$user=$_POST['txtuser'];
$pass=$_POST['txtpass'];
echo "$user";
echo "$pass";
include "conn.php";
$sql="select tbusers.id_units,
tbusers.username,
tbusers.pass,
tbusers.id_level,
tblevel.name_lavel,
tbunits.name_units,
tblevel.id_level,
tbunits.id_units
FROM
tbusers
Inner Join tbunits ON tbunits.id_units = tbusers.id_units
Inner Join tblevel ON tblevel.id_level = tbusers.id_level
WHERE
tbusers.username = '$user' AND
tbusers.pass = '$pass'";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
$rs=mysql_fetch_array($result);
$_SESSION['username']=$rs['username'];
$_SESSION['pass']=$rs['pass'];
$_SESSION['units']=$rs['id_units'];
$_SESSION['level']=$rs['id_level'];
$_SESSION['name_level']=$rs['name_lavel'];
$_SESSION['name_units']=$rs['name_units'];
if ($_SESSION['level']=="1"){
echo "<script>alert('ยินดีต้อนรับเข้าสู่ระบบ');
window.location='tell.php';
</script>";
exit();
}
else if ($_SESSION['level']=="2"){
echo "<script>alert('ยินดีต้อนรับเข้าสู่ระบบ');
window.location='tell.php';
</script>";
exit();
}
else {
echo "<script>alert('กรุณาตรวจสอบการ Login ใหม่');
window.location='login.html';
</script>";
exit();
}
?>
|
|
|
|
|
Date :
2009-09-27 20:54:45 |
By :
oasiis |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include "conn.php"; หมายถึง อาราย หรอ ครับๆ พี่
|
|
|
|
|
Date :
2009-09-28 13:36:36 |
By :
tamikazee |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|