Under my login script after checking the DB pages gets redirected but page messed up. My login page and dashboard page opens at login page rather redirect to dashboard.
my login check script is below
<?php
include_once'\..\database\connection.php';
class loginDetails extends connection{
private $result,$query,$count;
public function checkLogin($adusername,$adpassword){
$adusername=mysqli_real_escape_string($this->con,$adusername);
$adpassword=mysqli_real_escape_string($this->con,$adpassword);
$this->query= "select * from quoteslogin where Username='$adusername' AND Password='$adpassword'";
$this->result= mysqli_query($this->con,$this->query);
$this->count= mysqli_num_rows($this->result);
if($this->count < 1)
{
echo "Access Denied";
}
else
{
$row= mysqli_fetch_array($this->result);
$_SESSION["quotes_username"]=$row["Username"];
$_SESSION["quotes_password"]=$row["Password"];
header("Location: http://www.google.com/");
// header("Location:admin/dashboard.php");
exit();
}
}
I put google.com in the location but my login pages shows only loading image and dosnt redirect on google no any error. My script is working as i have checked it and it echo correctly.
My connection string
class connection {
private $host="localhost",$dbusername="root",$dbpassword="",$dbname="quotation";
public $con;
public function __construct() {
$this->con= mysqli_connect($this->host, $this->dbusername, $this->dbpassword, $this->dbname);
}
}
If i use flush() before the header than script shows "headers already sent...." if i remove it works just like image