-1
訪問返回變量,這是一個使用「登錄」功能的腳本,它返回兩個變量,怎麼會在這裏的時候,我試圖把他們從的sanitize函數「登錄」功能,它不「科技工作如何從功能
的index.php
<?php
if(!empty($_POST['submit']))
{
include("check.php");
$class = new check;
$user = $_POST['username'];
$pass = $_POST['password'];
$results = $class->sanitize($user, $pass);
$class->login($results[0], $results[1]);
//$class->login($user, $pass);
}
?>
check.php
function sanitize($string, $string2)
{
$stringh = htmlentities($string);
$string1h = htmlentities($string2);
$stringht = trim($stringh);
$string1ht = trim($string1h);
return $stringht;
return $string1ht;
}
function login($user, $pass)
{
$result = $this->link->query("SELECT * FROM `login` WHERE `username` = '".$user."'");
$numbers = mysqli_num_rows($result);
if($numbers != 0)
{
while($row = mysqli_fetch_assoc($result))
{
$dbuser = $row['username'];
$dbpass = $row['password'];
}
if($dbuser == $user && $dbpass == $pass)
{
echo "You have a match.";
}
}
}
或者,接受輸入的陣列和輸出返回一個數組。 –
謝謝。 @collin從來不知道這一點。 – Cesarg219
他們已經在這樣做,lascort。 –