Ir para conteúdo
Fórum Script Brasil

jottab

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre jottab

jottab's Achievements

0

Reputação

  1. Preciso saber onde estou errando no código abaixo. Se o nível do usuario for 1 ele é direcionado para página de administrador,senão ele vai para página comum.Se não for cadastrado retorna a página de login. Código abaixo.] login.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-… <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login</title> <link href="midia/css/estilo.css" rel="stylesheet" type="text/css" /> <link href="midia/css/formulario.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="geral"> <?php session_start(); include_once ('cabecalho.php'); ?> <form action="verifica_login.php" method="post" name="logar"> <table width="215" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2">Logar</td> </tr> <tr> <td width="70"><p class="formulario">Email:</p></td> <td width="277"><input name="email" type="text" class="campos" id="email" value="" size="30" maxlength="70" /></td> </tr> <tr> <td><p class="formulario">Senha:</p></td> <td><input name="senha" type="password" class="campos" id="senha" value="" size="30" maxlength="32" /></td> </tr> <tr> <td><input type="hidden" name="acao" value="email"/></td> <td><input name="logar" type="submit" class="botao" id="logar" value="Logar" /></td> </tr> </table> </form> </div> </body> </html> ######################################… valida-login.php <?php session_start(); require_once('classes/executar.php'); $sel = "SELECT * FROM usuario WHERE email='".$_POST['email']."' and senha=MD5('".$_POST['senha']."')"; $res = mysql_query($sel, $conexao) or die ("não foi possivel realizar a consulta."); while($linha = mysql_fetch_array($res)){ $nivel = $linha["nivel"]; } if ($linha) { $_SESSION['usuarioLogado']=$linha['… $_SESSION['usuarioLogadoId']=$linha… $_SESSION['usuarioNivel'] = $linha['nivel']; }elseif($nivel=1){ header("Location: home.php"); }else{ $_SESSION['usuarioLogado']=não'; $_SESSION['usuarioLogadoId]='x'; $_SESSION['usuarioNivel']='0'; header("Location: login.php"); } break; ?>
×
×
  • Criar Novo...