0
<?php include("C:/xampp/htdocs/mySalon/connect_database.php");?>
			  
			 <?php 

if(isset ($_POST ['username']) && $_POST ['password']){
$username = $_POST['username'];
$password=$_POST['password'];




$query=mysql_query("SELECT * FROM admin WHERE username='$username'");
$numrows=mysql_num_rows($query);

if ($numrows!=0)
{

	while ($row=mysql_fetch_assoc($query))
	{
		$dbusername=$row['username'];
		$dbpassword=$row['password'];
	}
	//check to see if they match!
	if ($username==$dbusername&& md5 ($password)==$dbpassword)
	{
		
		header ('Location: http://localhost/mySalon/admin/admin_page.php');
		$_SESSION['username'] = $username;
	}
	else
		echo "Incorrect Password";
}
else 
 echo "You are not the administrator";
 }
else
  echo "";

?>
5
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by cwarn23
0

ensure that there is NO output in the file prior to header(). That is, no error echo, no html, no whitespace, nothing.

If you check and there is definitely no output, you may have an issue witht he file format. You should save your files as UTF-8 WITHOUT BOM (e.g. in more advanced text editors like Notepad++). Often text editor will default to ANSI or other. BOMs cause 'invisible' output which mess up header().

0

In this instance simply delete the white spacing on lines 1 and two so delete everything before <?php on line 1 and 2.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.