所以我有這個登錄PHP腳本,我正在使用,它在一臺服務器上正常工作(返回「成功」||「無效登錄」),然後這個其他服務器它打破,因爲它返回一個換行符,然後「成功」或「無效登錄」這段代碼爲什麼在echo之前返回換行符?
我的猜測是一個php.ini設置。我只是不確定哪一個。
<?php
include("../config.php");
include("../connect.php");
$adminCheck = mysql_query("SELECT * FROM admins WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" . mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($adminCheck) == 1)
{
$result = mysql_fetch_array($adminCheck);
$_SESSION['user']['level'] = "admin";
$_SESSION['user']['userid'] = $result['id'];
$_SESSION['user']['username'] = $result['username'];
echo "success";
}
else
{
$clientCheck = mysql_query("SELECT * FROM clients WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" . mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($clientCheck) == 1)
{
$result = mysql_fetch_array($clientCheck);
$_SESSION['user']['level'] = "client";
$_SESSION['user']['userid'] = $result['id'];
$_SESSION['user']['username'] = $result['username'];
$_SESSION['user']['client'] = $result['client'];
echo "success";
}
else
{
echo "invalid login";
}
}
?>
檢查裏面'config.php'和'connect.php',可能會發生在那裏 –
哦right..duh..be回到一秒 – Ronnie
抱歉..等待客戶給我發電子郵件的文件... – Ronnie