PHP Problem - using header()
Posted: Wed May 11, 2005 4:40 am
Ok, I am trying to create a basic login system for my site. I have been testing and without using include files, the code works great. But with the includes I get:
I know the connection string and everything is correct as the code works fine without the header command. Is there any way to link to another page or open a file without using header()?
As you can probaly tell im new to coding so please any simple solutions would be appreciated.
Thanks in advance.
This is my code:Warning: Cannot modify header information - headers already sent by (output started at /home/joecul41/public_html/index.php:11) in /home/joecul41/public_html/inc_files/login.inc on line 24
Code: Select all
if (isset($_POSTї'Submit']))
{
$username = $_POSTї'username'];
$password = $_POSTї'password'];
$result = mysql_query("e;Select * From users where username='$username'"e;,$link);
if(mysql_num_rows($result)>0)
{
$row = mysql_fetch_array($result, MYSQL_BOTH);
if($password == $rowї"e;password"e;])
{
if($rowї"e;securitylevel"e;] == "e;1"e;)
{
$_POSTї'username'] = "e;username"e;;
$_POSTї'password'] = "e;password"e;;
$msg = "e;Admin Login"e;;
header("e;Location: admin.php"e;);
}
else
{
$msg = "e;Member Login"e;;
}
}
else
{
$msg = "e;Password incorrect"e;;
}
}
else
{
$msg = "e;Username incorrect"e;;
}
}
?>As you can probaly tell im new to coding so please any simple solutions would be appreciated.
Thanks in advance.