|
|
|
ช่วย เรื่อง การ login หน่อยคับ เป็นโค๊ด หน้าเช็ค login คับ แต่จะเพิ่ม การเช็ค ว่า ได้รับการอนุมัติ |
|
|
|
|
|
|
|
Code (PHP)
<?php
session_start() ;
$user_login = $_POST['user_login'];
$pwd_login = $_POST['pwd_login'];
if(isset($user_login) and isset($pwd_login)) {
include("Connections/config.inc.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 user,password from member where user='$user_login' and password='$pwd_login' and active="Y" ") ; // จะ "Y" หรือ 'Y' นีแหละคับลองดู
$num = mysql_num_rows($result) ;
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>";
}
else {
$dbarr = mysql_fetch_array($result) ;
if($user_login!=$dbarr['user'] and $pwd_login!=$dbarr['password']) {
echo "รหัสผ่านไม่ถูกต้อง" ;
}else {
$_SESSION['login_true'] = $user_login;
echo "<meta http-equiv='refresh' content='0 ;url=member_detail.php'>" ;
}
}
}
?>
</body>
</html>
|
|
|
|
|
Date :
2010-06-13 16:17:04 |
By :
chaynuwong |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วถ้า ยังไม่ได้อนุมัติ ให้มัน ฟ้อง ด้วยอะคับ ต้อง if ยังไงดีคับ ช่วยอีกหน่อยนะคับ
|
|
|
|
|
Date :
2010-06-13 19:09:44 |
By :
pumin99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
session_start();
if(isset($_POST['Submit'])){
$username=trim($_POST['username']);
$password=trim($_POST['password']);
$passen=base64_encode(base64_encode(base64_encode($password)));
$SQL="SELECT user_id,username,password,isadmin,isactive FROM user WHERE username='$username' and password='$passen' ";
$rs=$db->Execute($SQL)or die('ERROR1');
$num=$rs->NumRows();
$result=&$rs->fields;
$_SESSION['sess_user_id']=$result['user_id'];
$_SESSION['sess_username']=$result['username'];
$_SESSION['sess_isadmin']=$result['isadmin'];
$_SESSION['sess_isactive']=$result['isactive'];
$isactive=$result['isactive'];
if($num<>0){
if($isactive=='N'){/*ฟิลด์ active คือกำหนดสถานะการเข้าใช้นะครับ ลองประยุกต์ดูครับ */
echo"<script>alert(\"คุณยังไม่ได้รับอนุญาติเข้าใช้งาน กรุณาติดต่อเจ้าหน้าที่เกี่ยวข้อง\");</script>";
}
else{
$SQL1="UPDATE user SET lastlogin=$datenewnow WHERE username='$username' and password='$passen' ";
$rs1=$db->Execute($SQL1)or die('ERROR2');
echo"<script>window.location='code/main.php';</script>";
}
}
else{
echo"<script>alert(\"ชื่อหรือรหัสผ่านไม่ถูกต้อง\");</script>";
}
}
?>
|
|
|
|
|
Date :
2010-06-13 23:19:47 |
By :
sleepington |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|