View Single Post
  #24  
Old 04-15-2005, 11:48 PM
KoBrA is offline KoBrA
Registered User

Join Date: Jul 2004
Posts: 25

Send a message via AIM to KoBrA
mine? ... its the same as he gave me

Code:
<?
function login_form() {?>

	<form method="post" action="<?Echo($_SERVER['PHP_SELF']);?>">
	Username: <input type="text" name="username" /><br />
	Password: <input type="password" name="password" /><br />
	<input type="hidden" name="login" value="true" />
	<input type="submit" name="login" value=" Login " /> <input type="reset" value=" Reset " />
	</form>

<?}

If($_POST['login']) {

	$username=mysql_real_escape_string($_POST['username']);
	$password=mysql_real_escape_string($_POST['password']);
	
	$query=mysql_query("SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1");
	
	If(mysql_num_rows($query) > 0) {
		setcookie("loggedin","true",time+36000); //1 day
		sleep(1);
	}
	mysql_free_result($query);
	
	header("Location: ".$_SERVER['PHP_SELF']);
	exit;

}



If($_COOKIE['loggedin']!="true") {

	Echo(" You do not have permission to access this page. Please login Below. ");
	login_form(); // print the login form
	exit;

}?>
__________________
Reply With Quote