klasss Posted March 3, 2014 at 03:28 PM Report #547358 Posted March 3, 2014 at 03:28 PM Boas, Tenho um login sem Base de dados, ou seja, Basta a pessoa colocar certas credenciais e pode entrar. Agora gostaria de saber se com este codigo consigo colocar mais utilizadores. <?php require("index.html"); $login = $_POST['login']; $password = $_POST['password']; if($login !=admin || $password !=admin ){ header("Location:index.html");} else {header("Location:Administrador.php");} ?>
bioshock Posted March 3, 2014 at 05:21 PM Report #547396 Posted March 3, 2014 at 05:21 PM (edited) if($login == 'Portugal' && $password == 'Programar' || $login == 'PAP' && $password == 'Portugal'){ header('location: administrador.php'); }else{ header('location: index.html'); } exit(); Edited March 3, 2014 at 05:22 PM by bioshock
oxyzero Posted March 3, 2014 at 09:05 PM Report #547439 Posted March 3, 2014 at 09:05 PM Hmmn, podes fazer um array associativo, e verificar se o id existe quando verificas o input do utilizador. Por exemplo: <?php $users = array("user1" => "pass1", "user2" => "pass2"); $login = $_POST['login']; $password = $_POST['password']; if (isset($users[$login]) && $users[$login] == $password){ echo "Sucesso!"; }else echo "Login falhou"; 1 Report
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now