|
|
|
รบกวนช่วยดูหน่อยครับ appserv มีปัญหาหรือเปล่าครับ session ไม่ทำงานครับ |
|
|
|
|
|
|
|
ลองลบลงใหม่ซิครับ
แบล็คอัพไฟล์ไว้ก่อนนะครับ
|
|
|
|
|
Date :
2012-09-12 01:14:06 |
By :
showroom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอา Code มาดูครับ
|
|
|
|
|
Date :
2012-09-12 06:08:09 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ประกาศ
<?php
ob_start();
start_session();
?>
ไว้บรรทัดแรกสุดของ page ครับ
|
|
|
|
|
Date :
2012-09-12 09:27:42 |
By :
adaaugusta |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำ session_start(); ไว้ทุกหรือหรือเป่าเอ่ย
|
|
|
|
|
Date :
2012-09-12 09:37:34 |
By :
Ex-[S]i[L]e[N]t |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่หายเลยครับแปลกจัง ..
Code login.php
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<? ob_start(); @session_start(); ?><? extract($_REQUEST); ?>
<?include ("include/cndb.php");$db_conn = connectdb::connect(); $con = new connectdb($db_conn);
$login =$_SESSION[login];
if($login == "yes") {
echo "<meta http-equiv='refresh' content='0;url=index.php'>" ;
}
if($_POST['txtUser']!="" && $_POST['txtPass']!="")
{
$user = $_POST['txtUser'];
$pass = $_POST['txtPass'];
$con->strTable = "admin_wtc";
$con->strCondition = " username = '$user' ";
$con->strCondition1 = " password = '$pass' ";
$objSelect = $con->fncSelectRecord2();
if(!$objSelect)
{
?>
<script>
alert("Username or password is not correct")
window.location="login.php";
</script>
<?
}
else
{
$con->strTable = "admin_wtc";
$con->strCondition = " username = '$user' ";
$con->strCondition1 = " status ='0' ";
$objSelect = $con->fncSelectRecord();
if(!$objSelect)
{
echo "user status not found<br>"
?>
<script>
alert("Username is not empty.")
window.location="login.php";
</script>
<?
}
else
{
$login="yes";
$_SESSION["login"] = $login ;
session_register("login");
$IP=getenv(HTTP_X_FORWARDED_FOR);
if($IP == "")
{
$IP= $_SERVER['REMOTE_ADDR'];
}
$strSQL = "UPDATE admin_wtc SET status=1 WHERE username='$user'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$timestart=date("d-m-Y | H:i:s");
$con->strTable = "admin_log";
$con->strField = "alid,username,timein,timeout,ip";
$con->strValue = " '','$user','$timestart','NULL','$IP'";
$objInsert = $con->fncInsertRecord();
echo "<meta http-equiv='refresh' content='1;url=index.php'>" ;
}
}
}
mysql_close();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WTCsolution | Sign In</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<script type="text/javascript" src="resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
<script type="text/javascript">
DD_belatedPNG.fix('.png_bg, img, li');
</script>
<script language = "Javascript">
function ValidateForm()
{
if(document.fmlog.txtUser.value == "")
{
alert('Please insert Username ');
document.fmlog.txtUser.focus();
return false;
}
if(document.fmlog.txtPass.value == "")
{
alert('Please insert Password ');
document.fmlog.txtPass.focus();
return false;
}
document.fmlog.submit();
}
</script>
</head>
<body id="login">
<div id="login-wrapper" class="png_bg">
<div id="login-top">
<h1>WTCsolution</h1>
<img id="logo" src="resources/images/logo.png" alt="Simpla Admin logo" />
</div>
<div id="login-content">
<form id="fmlog" name="fmlog" method="post" action="" onSubmit="return ValidateForm()">
<div class="notification information png_bg">
<div>
Just click "Sign In". No password needed.
</div>
</div>
<p>
<label>Username</label>
<input class="text-input" type="text" name="txtUser" id="txtUser" />
</p>
<div class="clear"></div>
<p>
<label>Password</label>
<input class="text-input" type="password" name="txtPass" id="txtPass"/>
</p>
<div class="clear"></div>
<p id="remember-password">
<input type="checkbox" />Remember me
</p>
<div class="clear"></div>
<p>
<input class="button" type="submit" value="Sign In" />
</p>
</form>
</div>
</div>
</body>
</html>
|
|
|
|
|
Date :
2012-09-13 20:03:53 |
By :
hackcode |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต่อไปหน้า index.php
Code (PHP)
<? include ("include/session_check.php");include ("include/cndb.php");$db_conn = connectdb::connect(); $con = new connectdb($db_conn);
$strSQL = "SELECT * FROM Event WHERE Status='1' ";$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620" />
<title>WTCsolution</title>
</head>
</body>
โค๊ด html ปกติ มันเยอะมาก ผมเลยไม่ได้เอามาใส่ครับ
</body>
</html>
|
|
|
|
|
Date :
2012-09-13 20:08:26 |
By :
hackcode |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้ session_check.php
Code (PHP)
<? ob_start(); @session_start();
$login =$_SESSION[login];
if($login != "yes") {
echo "<meta http-equiv='refresh' content='0;url=login.php'>" ;
exit() ;
}
?>
|
ประวัติการแก้ไข 2012-09-13 20:11:00
|
|
|
|
Date :
2012-09-13 20:09:26 |
By :
hackcode |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|