|
|
|
ช่วยหน่อยคับloginคับ eror บรรทัดที่25 $con = mysql_connect( |
|
|
|
|
|
|
|
<?
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("onlineshop",$con);
$sql = "select * from users where user_name =' ". $_post["user_name"]." ' and pwd_name1=' ".$_post["pwd_name1"];
$table = mysql_query($sql, $con);
if ($row = mysql_fetch_array ($table)); {
$session_id = "";
for ($i = 0; $i < 10; $i++); {
$session_id = $session_id .rand(0, 9);
}
$sql = "delete from sessions where user_name='". $_post["user_name"];
$table = mysql_query($sql,$con);
$sql= "insert into sessions (user_name,pwd_name1)
values ('".$_post["$user_name"]."' and pwd_name1 ='".$_post["pwd_name1"];
$table = mysql_query($sql,$con);
setcookie("user_name", $row["user_name"], time() + 3600);
setcookie("pwd_name1", $session_id, time() + 3600);
setcookie("basket", ";", time()+3600);
} else {
header("location: login.php");
}
mysql_close($con);
?>
มันerror ต้องelse พอดีคับไม่รู้มันผิดตรงไหน ช่วยทีนะครับขอบคุณครับ
Tag : - - - -
|
|
|
|
|
|
Date :
24 พ.ย. 2549 17:59:27 |
By :
ป๋าดร |
View :
1830 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้อีกอันของผมคับ ก๊อปกระทู้อื่นมา errorบรรทัดที่ $num_rows = mysql_num_rows($dbquery);
ช่วยด้วยค๊าบ
<?
$host="localhost";
$username="root";
$password="";
$db="onlineshop";
$tb="users";
mysql_connect( $host,$username,$pass_word) or die ("ติดต่อกับฐานข้อมูล Mysql ไม่ได้ ");
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
$pwd_name1=md5($pwd_name1); // เข้ารหัส Md5
$sql = "select * from $tb where users='$user_name' and pwd_name1='$pwd_name1'";
$dbquery = mysql_db_query($db, $sql);
$num_rows = mysql_num_rows($dbquery);
if(empty($num_rows))
{
echo"<br><center>user หรือ password ไม่ถูกต้อง</center></br>";
}
else
{
session_register("user_name");
header('location:admintools.php');
}
?>
|
|
|
|
|
Date :
24 พ.ย. 2549 18:03:50 |
By :
ป๋าดร |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dbquery = mysql_db_query($db, $sql);
ลองเปลี่ยนจากดานบนเป้นแบบนี้ดูนะครับ
$dbquery = mysql_query($sql);
หากยังไม่ได้ก็บอกนะครับ
|
|
|
|
|
Date :
27 พ.ย. 2549 04:34:04 |
By :
c-sis |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันใช้ต่างกันยังไงเหรือครับ
|
|
|
|
|
Date :
26 ก.พ. 2550 17:31:07 |
By :
iowa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|