Ljrbrasil 0 Denunciar post Postado Maio 23, 2015 Pessoal Boa tarde! Tenho a tela a baixo de login e gostaria que alguns usuários quando fizesse o login ao invés de ser direcionado para tela painel.php fosse para painel2.php ( um tela de usuário e uma tela administrador) Alguém poderia me ajudar? <?php require_once('Connections/conexao.php'); ?><?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['login'])) { $loginUsername=$_POST['login']; $password=$_POST['senha']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "../painel.php"; $MM_redirectLoginFailed = "erro.htm"; $MM_redirecttoReferrer = false; mysql_select_db($database_conexao, $conexao); $LoginRS__query=sprintf("SELECT login, senha FROM sistema_de_login WHERE login='%s' AND senha='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $conexao) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <html> <head> <title>°°Envio de Vendas°°</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .campo_alerta { font-family: Verdana; font-size: 11px; background-color: #FFFFCC; } .texto_pagina { font-family: Verdana; font-size: 11px; color: #333333; } .tabela_formulario { width: 200; } .titulo_campos { font-family: Verdana; font-size: 11px; color: #333333; font-weight: bold; } .campos_formulario { font-family: Verdana; font-size: 11px; color: #333333; background-color: whitesmoke; } .botao_enviar { font-family: Verdana; font-size: 11px; color: white; background-color: gray; } a{ text-decoration: none; color: #333333; } a:hover{ text-decoration: underline; } --> </style> </head> <body background="../imagens/fundo.gif" link="#FFCC00" vlink="#FFCC00" alink="#FFCC00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <p> </p><table width="700" height="2%" border="0" align="center" cellPadding="10" cellSpacing="0" bgColor="#ffffff" class="texto_pagina" style="BORDER-RIGHT: gainsboro 1px solid; BORDER-LEFT: gainsboro 1px solid"> <tbody> <tr> <td height="486" vAlign="top"> <table class="texto_pagina" cellSpacing="0" cellPadding="0" width="678" align="center" bgColor="white" border="0"> <tbody> <tr bgcolor="#F7F7F7"> <td width="211" height="65"> <p align="center"><strong><font color="#006600">Controle de Liberação</font></strong></p></td> <td width="463" vAlign="middle"> <p align="center">Seja bem vindo ao nosso sistema.</p></td> </tr> </tbody> </table> <div align="center"> <strong><br> </strong> </div> <div align="center"> </div> <div align="center"> <table class="texto_pagina" style="BORDER-RIGHT: #dfdfdf 5px solid; BORDER-TOP: #dfdfdf 5px solid; BORDER-LEFT: #dfdfdf 5px solid; BORDER-BOTTOM: #dfdfdf 5px solid" cellSpacing="0" cellPadding="10" width="90%" align="center" bgColor="white" border="0"> <tbody> <tr> <td><font color="#60707f"><b><strong><font color="#cf0800">Entrar no sistema</font></strong><br> </b></font>Informe abaixo seu login e senha para ter acesso ao sistema:<font color="#60707f"><b><br> <br> </b></font> <table width="350" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"><p align="center"><font face="Arial, Helvetica, sans-serif"><strong><font color="#cf0800" size="2">Sistema de Controle de Liberação</font></strong></font></p></td> </tr> <tr> <td align="center" valign="middle"> </td> </tr> <tr> <td height="88" align="center" valign="middle"><form name="form1" method="POST" action="<?php echo $loginFormAction; ?>"> <table width="300" border="0" align="center" cellpadding="0" cellspacing="0"> <tr align="center" valign="middle"> <td width="100"><div align="left"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Login</strong></font></div></td> <td width="200"><div align="left"> <input class="campos_formulario" style="WIDTH: 100%" maxLength="50" name="login" id="login4" size="20"> </div></td> </tr> <tr align="center" valign="middle"> <td><div align="left"> <p><font size="2" face="Arial, Helvetica, sans-serif"><strong>Senha</strong></font></p> </div></td> <td><div align="left"> <input class="campos_formulario" style="WIDTH: 100%" type="password" maxLength="10" value name="senha" size="20"> </div></td> </tr> <tr align="center" valign="middle"> <td> </td> <td><div align="left"> <input type="submit" name="Submit" value="Entrar"> </div></td> </tr> <tr align="center" valign="middle"> <td> </td> <td><p> </p></td> </tr> </table> </form></td> </tr> <tr> <td align="center" valign="middle"> </td> </tr> </table> <font color="#60707f"> </font></td> </tr> </tbody> </table> <strong></strong></div> <div align="center"> </div> <table class="texto_pagina" style="BORDER-RIGHT: 1px outset; BORDER-TOP: 1px outset; BORDER-LEFT: 1px outset; BORDER-BOTTOM: 1px outset" cellSpacing="0" cellPadding="10" width="90%" align="center" bgColor="whitesmoke" border="0"> <tbody> <tr> <td> </td> </tr> </tbody> </table></td> </tr> </tbody> </table> </body> </html> Compartilhar este post Link para o post Compartilhar em outros sites
Jeovane Carvalho 6 Denunciar post Postado Maio 23, 2015 Você teria que trabalhar com permissões tipo assim Usuário *permissão 2* Administradores *permissão 1* não é difícil fazer já que você já têm um sistema, veja no Blog do Thiago Belém têm um tuto lá que poderá resolver seu problema, é só acompanhar a sua explicação: http://blog.thiagobelem.net/como-criar-um-sistema-de-login-com-niveis-de-permissao/ Compartilhar este post Link para o post Compartilhar em outros sites