ไม่รู้ code ผิดตรงไหน(php) ไม่ส่งค่าจาก formไฟล์ html ไปไฟล์ php
//login_session.php
Code (PHP)
<?
//ob_start();
//session_start();
$link = mysql_connect("localhost", "root", "1234");
mysql_query("SET NAMES utf8", $link);
mysql_query("Use formdb;");
//$name=$_POST[name];
$username=$_POST[username];
$password=$_POST[password];
$usernamedb = "Select username from form where username=$username;";
$passworddb = "Select password from form where password=$password;";
if(($usernamedb)&&($passworddb)){
//session_start();
session_register("usernamedb");
session_register("passworddb");
echo "<a href=admin_session.php>เข้าสู่ระบบ</a>";
} else {
echo "Error Login";
}
//ob_end_flush();
?>
Date :
2013-03-31 20:10:30
By :
Note
$usernamedb = "Select username from form where username=$username;";
$passworddb = "Select password from form where password=$password;";
ตรง from from ทำไมถึง from 2 อ่าครับ
Date :
2013-03-31 20:14:35
By :
momotaro12
Code (PHP)
<?
//ob_start();
//session_start();
$link = mysql_connect("localhost", "root", "1234");
mysql_query("SET NAMES utf8", $link);
mysql_query("Use formdb;");
//$name=$_POST[name];
$username=$_POST['username'];
$password=$_POST['password'];
$num_row=mysql_query("SELECT * FROM tb_example WHERE username='".$username."' AND password='".$password."'");
if($num_row == 1){
//session_start();
$select=mysql_query("SELECT * FROM tb_example WHERE username='".$username."' AND password='".$password."'");
$result=mysql_fetch_array($select);
$_SESSION['username']=$result['username'];
$_SESSION['password']=$result['password'];
echo "<a href=admin_session.php>เข้าสู่ระบบ</a>";
} else {
echo "Error Login";
}
//ob_end_flush();
?>
ประวัติการแก้ไข 2013-03-31 20:16:42
Date :
2013-03-31 20:15:25
By :
Ex-[S]i[L]e[N]t
Load balance : Server 04