Below is some code for my login screen. Where it is written "meta redirect to ......" , i actually need these to take me to another php page in the same directory. Can anyone advise me how to do this??
Also when the page is redirected i want it to carry the $username variable through to that page so it can be used on that page. Any ideas???
Any help greatly appreciated.
Thanks
<?php include("header.inc"); ?>
<h2>Login</h2>
<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
<table>
<tr><td>UserName:</td><td><input type="text" name="UserName"></td></tr>
<tr><td>Password:</td><td><input type="password" name="Password"></td></tr>
</table>
<input type="submit" name="login" value="Login">
</form>
<?
//open db connection
//Database Details
$server="localhost";
$dbusername="root";
$dbpassword="voBtGM";
$db_name="JobBase";
$connection = mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = mysql_select_db($db_name, $connection) or die(mysql_error());
if (isset($_POST) && $_POST['login'] == "Login") { //if the submit button is pressed...
//surely you want to select rows where username AND password match the posted values?
$select = mysql_query("SELECT * FROM Members WHERE UserName = '".$_POST['UserName']."' AND Password = '".$_POST['Password']."'") or die(mysql_error());
//check that record exists
if (mysql_num_rows($select) != 1) {
echo ("Oops! Your username and password did not match our records!");
} else {
$row = mysql_fetch_assoc($select);
if($row['Status'] == 1) { echo ("Meta redirect to the advertisers page here"); }
else { echo ("Meta redirect to the searching page here");
}
}
//close db connection
mysql_close($connection);
}
?>
</body>
</html>