FunkyBlueStick
12-29-2000, 06:45 PM
I'm trying to write a simple php authentication script to stop people deleting stuff out of a database with out permission.
Could someone tell me what is wrong with this script?
<html>
<body>
<form method=post action="<?php echo $PHP_SELF?>">
Name: <input type=text name=userid><br>
Password: <input type=password name=password><br>
<?php
echo ("<input type=hidden value=\"$id\" name=id>");
?>
<input type=submit>
<?php
if ($userid == "funky" and $password == "moviez")
{
header("Location: delete.php");
}
else
{
die ("You need to enter the correct Username/Password");
}
?>
</body>
</html>
When the password is wrong the script works but when it's right I get this:
Warning: Cannot add header information - headers already sent by (output started at /home/WWW/moviez/auth.php:3) in
/home/WWW/moviez/auth.php on line 14
I guess it's something to do with the header function but I can't see what!
Please help!
Thanks
(PS, auth.php is the name of the script http://www.linuxnewbie.org/ubb/smile.gif )
Could someone tell me what is wrong with this script?
<html>
<body>
<form method=post action="<?php echo $PHP_SELF?>">
Name: <input type=text name=userid><br>
Password: <input type=password name=password><br>
<?php
echo ("<input type=hidden value=\"$id\" name=id>");
?>
<input type=submit>
<?php
if ($userid == "funky" and $password == "moviez")
{
header("Location: delete.php");
}
else
{
die ("You need to enter the correct Username/Password");
}
?>
</body>
</html>
When the password is wrong the script works but when it's right I get this:
Warning: Cannot add header information - headers already sent by (output started at /home/WWW/moviez/auth.php:3) in
/home/WWW/moviez/auth.php on line 14
I guess it's something to do with the header function but I can't see what!
Please help!
Thanks
(PS, auth.php is the name of the script http://www.linuxnewbie.org/ubb/smile.gif )