db.php
<?php
$con = new mysqli("****","myword6815","****","wordpress381180_everestviewtravels_com_au");
?>
的login.php
<?php
if(session_status()!=PHP_SESSION_ACTIVE) session_start();
include '../functions/db.php';
$username = $_POST['username'];
$password = $_POST['password'];
$pwd = md5($password);
$username = mysqli_real_escape_string($con,$_POST['username']);
$password = mysqli_real_escape_string($con,$_POST['password']);
$query = "SELECT * FROM tblaccount WHERE username = '$username' AND password = '$pwd'";
$result = mysqli_query($con,$query) or die ("Verification error");
$array = mysqli_fetch_array($result);
if ($array['username'] == $username){
$_SESSION['username'] = $username;
$_SESSION['fname'] = $array['fname'];
$_SESSION['lname'] = $array['lname'];
$_SESSION['user_Id'] = $array['user_Id'];
header("Location: home.php");
}
else{
echo '<script language="javascript">';
echo 'alert("Incorrect username or password")';
echo '</script>';
echo '<meta http-equiv="refresh" content="0;url=../index.php" />';
}
?>
代码在localhost中运行得很好但是在实时页面中给出了以下错误消息:
警告:mysqli :: __ construct():php_network_getaddresses:getaddrinfo failed:/ clientdata/apache-www/e/v/everestviewtravels.com.au/www/forum/functions/db.php中未知的名称或服务第8行
警告:mysqli :: __ construct():( HY000 / 2002):php_network_getaddresses:getaddrinfo failed:/ clientdata/apache-www/e/v/everestviewtravels.com.au/www/forum/中未知名称或服务第8行的functions / db.php
警告:mysqli_real_escape_string():无法在第11行的/clientdata/apache-www/e/v/everestviewtravels.com.au/www/forum/pages/login.php中获取mysqli
警告:mysqli_real_escape_string():无法在第12行的/clientdata/apache-www/e/v/everestviewtravels.com.au/www/forum/pages/login.php中获取mysqli
警告:mysqli_query():无法在第15行的/clientdata/apache-www/e/v/everestviewtravels.com.au/www/forum/pages/login.php中获取mysqli 验证错误