|
 |
|
พี่ๆค้าบ ผมมีปัญหา=_= หลายอย่างเลย เกี่ยวกับ การตรวจสอบข้อมูล เพื่อไปหน้า admin กะ user |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
session_start();
mysql_connect("localhost","root","admin");
mysql_select_db("evaluation");
if (empty($s_id) || empty($s_pass)){
echo "Pls insert user and password";
}
else{
if ($session_s_s == "admin"){
header("location:admin_page.php");
}
else {
header("location:user_page.php");
}
}
mysql_close();
?>
|
 |
 |
 |
 |
Date :
2011-11-07 13:09:56 |
By :
Thep |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ แต่ยังมะได้อยุ่ดี T_T ติด if แรก empty
|
 |
 |
 |
 |
Date :
2011-11-07 14:06:05 |
By :
neverza123 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
if แรก ให้ echo $s_id หรือ $s_pass ออกมาดูครับว่าค่ามาหรือป่าว
|
 |
 |
 |
 |
Date :
2011-11-07 14:10:50 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
s_id ไม่ออก
แต่ s_pass ออก
ผมงงจัง- -'
Code (PHP)
<?
session_start();
mysql_connect("localhost","root","admin");
mysql_select_db("evaluation");
if (empty($s_id) || empty($s_pass)){
echo "$s_id , $s_pass";
}
else{
if ($session_s_s == "admin"){
header("location:admin_page.php");
}
else {
header("location:user_page.php");
}
}
mysql_close();
?>
มันต้องมี คำสั่ง ให้เข้า ถึง table ที่เราเก็บข้อมูล ของ user ไว้ไหมครับ
ตารางผมชื่อ user ไม่ทราบว่าเกี่ยวไหมหว่า
|
ประวัติการแก้ไข 2011-11-07 15:39:52
 |
 |
 |
 |
Date :
2011-11-07 15:38:17 |
By :
neverza123 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
session_start() ;
/* add by kergrit(redthird.com) for compatible global variable off/on php.ini */
$user_login = $_POST['user_login'];
$pwd_login = $_POST['pwd_login'];
if(isset($user_login) and isset($pwd_login)) {
include("connect.php") ;
?>
<html>
<head>
<title>:: ผลการเข้าสู่ระบบ ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body bgcolor="#FFFFCC">
<?php
$result = mysql_query("select Username,Password,admin from account where Username='$user_login' and Password='$pwd_login'") ;
$num = mysql_num_rows($result) ;
$dbarr = mysql_fetch_array($result) ;
$s=123;
if($num<=0) {
echo "<br><br><center><font size='3' face='MS Sans Serif'><b>รหัสผ่านไม่ถูกต้องครับ</b></font></center>" ;
print "<meta http-equiv=refresh content=3;URL=index.php>";
}
elseif($s= $dbarr['admin'])
{
$_SESSION['admin'] = $user_login;
echo "<meta http-equiv='refresh' content='0 ;url=admin.php'>" ;
}
else {
$_SESSION['login_true'] = $user_login;
echo "<meta http-equiv='refresh' content='0 ;url=indexs.php'>" ;
}
}
?>
</body>
</html>
อันนี้ของผมลองเอาไปประยุคใช้ดูครับ
|
 |
 |
 |
 |
Date :
2011-11-07 21:53:30 |
By :
ืnumchut |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|