InterbredMonkey
01-07-2010, 11:37 AM
I am trying to make a form to allow a user to sign into the webpage however I wanted to make the php check if the user had filled out all the details on the form and if not then display a message and then go back to the login page. I have put the header alteration in but it states that the header information has already been changed.
I think I know what is wrong as I am requesting information from the previous page before I can call the change of page but I dont know how I would do it any other way.
Any help would be greatly appreciated.
Code:
[code]
<?php
if(!empty($_REQUEST['email'])){$email = $_REQUEST['email'];}
else{$email = NULL; echo "<p><b>You have forgot to enter your email address. Please sign in again.</b>";};
if(!empty($_REQUEST['password'])){$password = $_REQUEST['password'];}
else{$password = NULL; echo "<p><b>You have forgot to enter your password. Please sign in again.</b>";};
$_REQUEST['signin'];
if($password && $email){
$dbcheck = mysql_query("select * from users where username = '$email'") or die(mysql_error());
}
else
{
sleep(5);
header('location: login.html');
};
?>
[code]
I think I know what is wrong as I am requesting information from the previous page before I can call the change of page but I dont know how I would do it any other way.
Any help would be greatly appreciated.
Code:
[code]
<?php
if(!empty($_REQUEST['email'])){$email = $_REQUEST['email'];}
else{$email = NULL; echo "<p><b>You have forgot to enter your email address. Please sign in again.</b>";};
if(!empty($_REQUEST['password'])){$password = $_REQUEST['password'];}
else{$password = NULL; echo "<p><b>You have forgot to enter your password. Please sign in again.</b>";};
$_REQUEST['signin'];
if($password && $email){
$dbcheck = mysql_query("select * from users where username = '$email'") or die(mysql_error());
}
else
{
sleep(5);
header('location: login.html');
};
?>
[code]