<?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 "";
?>
wonderlhily 0 Newbie Poster
Recommended Answers
Jump to Postensure 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 …
All 4 Replies

diafol
almostbob 866 Retired: passive income ROCKS
decade 2 Junior Poster in Training
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.