Return to Snippet

Revision: 14119
at May 19, 2009 15:33 by fackz


Initial Code
<?php
session_start();
if($_GET['acao']=="logar"){
	$senha = $_POST['pwd'];
	if($senha=="trielo"){
		$_SESSION['userName'] = "UserNameXXX";	
                $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']);
   		header("Location: /home.php");
		exit;		
	} else {
		echo "Senha incorreta!";
	}

}
?>

//other pages

<?php
session_start();
if((!$_SESSION['userName'])||($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT']))){
  header("Location: /");
exit;
}
?>

Initial URL

                                

Initial Description

                                

Initial Title
simple and basic login

Initial Tags

                                

Initial Language
PHP