我可以在localhost上获得访问权限,但是当我更改服务器时,它会提供此访问被拒绝错误。虽然我可以使用mysql访问服务器。 但我使用mysqli并给出了这个错误
的config.php
<?php
define("DBHOST", "hostname");
define("DBUSER", "user");
define("DBPASSWORD", "password");
define("DBNAME", "test1");
$DBCONNECT = new mysqli(DBHOST, DBUSER, DBPASSWORD, DBNAME);
?>
log_srcipt.php
<?php
session_start();//start session
$error = '';//to save error message
include_once('config1.php');
if(isset($_POST['submit']))
{
$userid = $_POST['userid'];
$pass= $_POST['pass'];
$sql = mysqli_query($DBCONNECT, "SELECT * FROM admin WHERE userid='$userid' and pass='$pass'") or die(mysqli_error());
//$count=mysql_fetch_array($sql);
$count = mysqli_num_rows($sql);
if($count == 1)
{
$_SESSION['userid'] = $userid;//$_POST['userid'];
echo "Successfully Login!!!";
//header("Location:add_menu.php");
}
else
{
echo "Wrong Username or Password";
}
}
/*
if(isset($_SESSION['userid']))
{
//header("Location:admin_dashboard.php");
echo "Admin is logged in";
}
else
{
header("Location:admin_login.php");
}
*/
?>