Re: [請益] 無法正常登入
感謝 dinos clubflymf arrack大<_ _ >
問題解決了
正如dinos大所說的 register_global ....囧""
我去查了一下linux上的php.ini register_global居然為Off.. 囧"""
後來改了on之後 程式都能夠正常執行 非常感恩各位
另外以下是register_global為off的情形
純脆想了解一下._.?a
我有
echo("select * from `admin` where `account`='$account'
: and `password`= '$password'");
的確沒錯 會出現
select * from `admin` where `account`='' and `password`=''
沒有取到值
後來我多加變成
$check=showsql("select * from `admin` where `account`='$account'
and `password`= '$password'");
$account=mysql_real_escape_string($_POST['account']);
$password=mysql_real_escape_string($_POST['password']);
echo("select * from `admin` where `account`='$account'
and `password`= '$password'");
這樣輸入值就可以取出來了
不過另外有嘗試以這種方式
我改成
if($_POST){
$account=mysql_real_escape_string($_POST['account']);
$password=mysql_real_escape_string($_POST['password']);
$check=showsql("select * from `admin` where `account`='$account'
and `password`= '$password'");
if(count($check)>0)
{
$_SESSION['admin']='test';
header("Location:aaa.php");
}
}
if($_SESSION['admin']=='test')
header("Location:aaa.php");
想讓他來抓取值 讓欄位等於$account和$password
來進行登入的話
他另外會出現
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]:
Access denied for user 'ODBC'@'localhost' (using password: NO)
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A
link to the server could not be established in
似乎沒有辦法連到資料庫
這也是因為global的問題嗎._.?"a
如果改以arrack大所說變成
$account=mysql_real_escape_string($_POST['account']);
的寫法
要如何讓他欄位能夠等於所輸入的$account呢 上面的寫的方式問題是出在哪呢._.?
非常感謝個位<_ _>
※ 引述《arrack (Arrack Tseng)》之銘言:
: ※ 引述《intangible (~*)》之銘言:
: : 恩恩 謝謝<_ _>
: : $check=showsql("select * from `admin` where `account`='$account'
: : and `password`= '$password'");
: : echo count($check);
: : }
: 我的引言為何都是白色的=_+ 這樣看起來好奇怪
: 你先echo("select * from `admin` where `account`='$account'
: and `password`= '$password'");
: 如果沒猜錯的話
: 應該是會出現
: select * from `admin` where `account`='' and `password`=''
: 如果是這樣,表示你的account跟password根本沒有去取值
: 如果是表單就用
: $account=mysql_real_escape_string($_POST['account']);//簡易用法
: 取一下值在試試看
: 這跟php.ini的設定有關係~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.181.103
推
07/31 15:07, , 1F
07/31 15:07, 1F
推
07/31 15:10, , 2F
07/31 15:10, 2F
→
07/31 15:10, , 3F
07/31 15:10, 3F
→
07/31 15:12, , 4F
07/31 15:12, 4F
推
07/31 15:46, , 5F
07/31 15:46, 5F
推
07/31 15:50, , 6F
07/31 15:50, 6F
→
07/31 15:50, , 7F
07/31 15:50, 7F
→
07/31 15:50, , 8F
07/31 15:50, 8F
→
08/02 12:56, , 9F
08/02 12:56, 9F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章