problems with header (“Location: ...
Posted: Mon Nov 07, 2005 4:08 pm
I have a simple login form that when run on my local server works great in checking the database for the username and encrypted password, then redirecting to the desired url. I’m trying to implement this on the real server (1&1) but am having problems with the redirection. After posting I get into the ‘if’ conditional where it should be redirecting, but instead i get a blank screen with my test echo. I’ve tried various file references such as ./file.php and ../file.php and /file.php and finally the entire http://www.url.com./file.php with the same lack of results. My knowledge of headers is perfunctory, but before I do some unnecessary in depth study I thought I’d asks the gurus, what am I missing? Any ideas?
Code: Select all
<?php
session_start();
require ($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
$connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting");
mysql_select_db($db_name, $connection);
require ($_SERVER["DOCUMENT_ROOT"]."/functions.php");
if ($_POST){
$error = login_check($_POST);
if (trim($error) == ""){
$_SESSION["member_id"] = login($_POST);
echo "trying to redirect.";
Header("Location: ./propertyInput.php");
exit();
}else{
print "Error:$error";
}
}
?>
<html>
<head>
<title>Property Input Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body>
<center><div align="center">
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<form action="<?php $_SERVER[PHP_SELF] ?>" method="post" enctype="multipart/form-data">
<label for="userid">Username</label>
<input type="text" name="username" id="username" />
<br />
<label for="password">Password</label>
<input type="password" name="password" id="password" />
<br />
<input type="submit" name="submit" value="Login" />
</form>
</td>
</tr>
</body>
</html>