I think I am going about this wrong. Unless there is a way to reference a previous entry in the login.php page.
I need
[php]username=‘john’ [/php]
to be
username=‘username entered from login.php’. The page I am working on now is memberzone.php, by the way.
here is the code from the login.php page.
[php] <?php
if(!empty($_SESSION[‘LoggedIn’]) && !empty($_SESSION[‘Username’]))
{
?>
Member Area
Thanks for logging in!
To search again, please click HERE
<ul>
<li><a href="logout.php">Logout.</a></li>
</ul>
<?php
}
elseif(!empty($_POST[‘username’]) && !empty($_POST[‘password’]))
{
$username = mysql_real_escape_string($_POST[‘username’]);
$password = md5(mysql_real_escape_string($_POST[‘password’]));
$checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'");
if(mysql_num_rows($checklogin) == 1)
{
$row = mysql_fetch_array($checklogin);
$email = $row['EmailAddress'];
$_SESSION['Username'] = $username;
$_SESSION['EmailAddress'] = $email;
$_SESSION['LoggedIn'] = 1;
echo "<h1>Welcome</h1>";
echo "<p>We are now redirecting you to the member area.</p>";
echo "<meta http-equiv='refresh' content='0;url=memberzone-test.php'>";
}
else
{
echo "<h1>Error</h1>";
echo "<p>Sorry, your account could not be found. Please <a href=\"login-test.php\">click here to try again</a>.</p>";
}
}
else
{
?>
Member Login
Thanks for visiting! Please either login below, or click here to register.
<form method="post" action="login.php" name="loginform" id="loginform">
<fieldset>
<label for="username">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="login" id="login" value="Login" />
</fieldset>
</form>
<?php
}
?>
[/php]
I might just sit down and do a bunch of tutorials to understand php and mysql better. I have figured out how to update the database user info… Obviously I didn’t put this site together. I am just responsible for updating it ;D. Thanks again for the help.