Thanks..
<?php
include "function.php";
if (isset($_POST["login"]))
{
//get the form data
$User_name = $_POST['Username'];
$Password = $_POST['Password'];
$rememberme = $_POST['RememberMe'];
if ($User_name && $Password )
{
$login = mysql_query("SELECT * FROM Agent_Details WHERE User_name='".$User_name."' LIMIT 1", $link);
while($row = mysql_fetch_assoc($login))
{
$dbUsername = $row['User_name'];
$dbPassword = $row['Password'];
if (md5($Password) == $dbPassword)
$loginok = TRUE;
else
$loginok = FALSE;
if($loginok == TRUE)
{
if ($rememberme=="on")
setcookie("User_name",$User_name,time()+7200);
else if ($rememberme == "")
$_SESSION['User_name'] = $User_name;
header("Location:registeredmember.php");
exit();
}
else
die("Incorrect Username/password combination");
}
}
else
{
die("Please enter a user name and password");
}
}
?>
<html>
<head>
<title>Agent Log in</title>
</head>
<body>
<div id="contact">
<form method="POST" name="agentForm" action="agentform.php" >
<p>
<h2>Agent Login</h2>
</p>
<p>
<label>Username</label>
<input id="Username" name="Username" maxlength="120" type="text" autocomplete="off"/>
</p>
<p>
<label>Password</label>
<input id="Password" name="Password" maxlength="120" type="password" autocomplete="off"/>
</p>
<p>
<input type="checkbox" name="RememberMe"/> Remember me <br />
</p>
<div id="buttons">
<input type="submit" name="login" value="Log In" />
</div>
</form>
</div>
<p>
<h3>
<a href="regForm.php">Register? </a>
</h3>
</p>
</body>
</html>
This post has been edited by macosxnerd101: 24 August 2011 - 10:52 AM
Reason for edit:: Fixed code tags

New Topic/Question
Reply



MultiQuote






|