Forum Moderators: coopster
<?php
$sql = mysql_query
("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
if($login_check > 0) {
$url="http://www.freshrod.com/MHS/MHS1986login_success.php";
header("Location: $url");
} else {
echo "<font color='red'>You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!</font><br />";
echo "<br /><a href=\"MHS1986login.html\">Back to Login Page</a>";
}
?>
then the page html is down here...
I know the header() has to appear before anything else is printed to the browser, but I don't like the way the error message appears outside (above at the top of the page) the html. Is there a way around this?
You can use a meta refresh if you want to:
function refresh($url)
{
?>
<html>
<head>
<title>Please wait..</title>
<meta http-equiv="refresh" content="2; url=<?php echo $url;?>">
</head><body>
Login successful...please wait..
</body>
</html>
<?php
}
and then..
if($login_check > 0) {
$url="http://www.freshrod.com/MHS/MHS1986login_success.php";
refresh($url);
exit;
}
Set the refresh rate to 0 if you want no message.
dc
[php.net...]