<!
<table border="0">
<tr>
<td><form id="form1" method="post" action="auth.php">
<table width="200" border="0">
<tr>
<td><label>Login:</label>
<input name="usuario" type="text" id="login" tabindex="1" size="20" /></td>
</tr>
<tr>
<td><label>Senha: </label>
</p>
<input name="senha" type="password" id="senha" tabindex="2" size="20" /></td>
</tr>
<tr>
<td><input name="Enviar" type="submit" tabindex="3" value="Enviar" />
<input name="Resetar" type="reset" value="Resetar" />
</td>
</tr>
</table>
</form></td>
</tr>
</table>
<?php
ob_start();
$login = array("usuario", "usuario2");
$senha = array("senha", "senha2");
$num = 0;
$numf = 2;
while ($num != $numf){
if ($login[$num] == $_POST['usuario'] && $senha[$num] == $_POST['senha']){
$auth = 1;
break;
}
else $num++;
}
switch ($auth){
Case 1:
$validacao = "crypto";
$usuario = $_POST['usuario'];
session_start();
$_SESSION[usuario] = $usuario;
$_SESSION[validacao] = $validacao;
header ("Location: protegida.php");
default:
include ("redir.php");
}
?>
<?
//Inicia a sessão
session_start();
//agora verifico se ele possui permissão para acessar a página
if ($validacao == "crypto")
{
?>
<<sua página protegida>>
<?
}
else
{
//exiba um alerta dizendo que a senha esta errada
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Aguarde... Redirecionando!</title>
<meta http-equiv="refresh" content="3;URL=form.php">
</head>
<body>
<h1>
<p>logue-se novamente!</p>
<p> </p>
<p>Redirecionando...</p>
</h1>
<p>caso você não seja redirecionado clique <a href="manuais_auth.php">aqui!</a> </p>
</body>
</html>
<?php } ?>
<?
ob_start();
//INICIALIZA A SESSÃO
session_start();
//DESTRÓI AS SESSOES
unset($_SESSION[usuario]);
unset($_SESSION[validacao]);
session_destroy();
//REDIRECIONA PARA A TELA DE LOGIN
Header("Location: form.php");
?>
![]() |
CodigoFonte.net » CodigoFonte.eti.br » Compre De Tudo » Meu Mural » PelamorDeDeus » Todos os Direitos Reservados © 2002/2008 |
Procurando Notebooks, Câmeras Digitais, iPhones?