OK I have now solved that problem but it still does not redirect to the right page, it now just produces the header banner and nothing else. This is the url that it ends up with once i click log-in (im new to php and mysql so is this correct?): http://www.mershamlehatchcc.co.uk/trial3php.php?op=login.
This is the php code at the moment:
[php] <?php
session_start();
// dBase file
include “dbConfig.php”;
$errmsg = 'Error Occured on Login'; // here we will store error message
if ($_GET["op"] == "login")
{
if (!$_POST[“username”] || !$_POST[“password”])
{
$errmsg = “You need to provide a username and password.”;
}
else{
// Create query
$q = “SELECT * FROM dbUsers
"
.“WHERE username
=’”.$_POST[“username”].”’ "
.“AND password
=PASSWORD(’”.$_POST[“password”]."’) "
.“LIMIT 1”;
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION[“valid_id”] = $obj->id;
$_SESSION[“valid_user”] = $_POST[“username”];
$_SESSION[“valid_time”] = time();
// Redirect to member page
Header("Location: memberstrial.php");
exit;
}
else
{
// Login not successful
$errmsg = “Sorry, could not log you in. Wrong login information.”;
}
}
}
else
{
//If all went right the Web form appears and users can log in
echo “<form action=”?op=login" method=“POST”>";
echo “Username: <input name=“username” size=“15”>
”;
echo “Password: <input type=“password” name=“password” size=“8”>
”;
echo “<input type=“submit” value=“Login”>”;
echo “”;
}
if($errmsg != ‘’)
{
echo $errmsg;
}
?>[/php]