|
|
|
Error คุกกี้? หน้าLogin อีกแล้ว!!!! (คราวนี้เอาcode ฉบับเต็มมาให้) |
|
|
|
|
|
|
|
รูป error
Code (PHP)
<?php
function loginchk()
{
include("admin/id.php");
$username=$_POST["username"];
$password=$_POST["password"];
if($username==NULL||$username=="/")
{
return 0;
}
$conn = mysql_connect($host, $user, $pw)or die("Can't Connect Database Server");
$dbs = mysql_select_db($dbname) or die("Cant Connect to SQL");
$command="SELECT password FROM account WHERE username='$username'";
$tmp1 = mysql_query($command, $conn)or die("Can't get Password infomation");
$cttmp2=mysql_fetch_array($tmp1);
if($cttmp2[0]==$password)
{
return 1;
}
else
{
return 0;
}
mysql_close;
}
include("admin/menubar.php");
if(loginchk()!=1)
{
echo "
<div id='hishadow'>
<center>
<form id='form' name='form' action='' method='post'>
<table width='34%' border='0'>
<tr>
<td width='50%'>username ::</td>
<td width='50%'>
<input type='text' name='username' id='username' />
</td>
</tr>
<tr>
<td>password ::</td>
<td>
<input type='password' name='password' id='password' />
</td>
</tr>
</table>
<p>
<input name='send' type='hidden' id='send' value='1' />
<label>
<input type='submit' name='submit' id='submit' value='Log in' />
</label>
</p>
</form>
</center>
</div>";
}
else
{
include("admin/id.php");
$conn = mysql_connect($host, $user, $pw)or die("Can't Connect Database Server");
$dbs = mysql_select_db($dbname) or die("Cant Connect to SQL");
$command="SELECT id FROM account WHERE username='$username'";
$tmp1 = mysql_query($command, $conn)or die("Can't get id infomation");
$igen=mysql_fetch_array($tmp1);
$strName=$_POST["username"];
setcookie("username",$strName,time()+3600);
setcookie("id",$igen[0],time()+3600);
mysql_close;
echo "<center>ทำการ Login เรียบร้อยแล้ว<center>";
}
?>
**เสริม
/admin/menubar.php คือ แถบเมนูข้างบน
/admin/id.php กำหนด $host,$user,$pw
Tag : PHP
|
|
|
|
|
|
Date :
2012-04-18 19:26:36 |
By :
pureexe |
View :
798 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Error นี้กระทู้เก่า ๆ มีเยอะมากครับ ลองดูครับ
|
|
|
|
|
Date :
2012-04-18 20:00:10 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เออ อยากจะถามว่า ทำไม ไม่ไปตั้งต่อที่กระทู้เก่าละครับ แบบนี้ Error ที่ 90-91 ไปไหนอะ หาบรรทัดนั้นไม่เจอ
|
|
|
|
|
Date :
2012-04-18 23:53:09 |
By :
thethaicom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|