RandoMixs 0 Denunciar post Postado Outubro 18, 2016 Quando a pessoa se loga no meu site e vai para o painel de administrador o painel fala que ela não esta logada! Eu criei um um usuario teste para vocês testarem, tambem vou passa o codigo que fiz ate agora! Painel Bugado http://webpanel.randogamer.tk < Usuario: teste / Senha: teste login.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Area de Login - WebHost RandoGamer</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="styles.css"> <style type="text/css"> .form-style-7{ max-width:400px; margin:50px auto; background:#fff; border-radius:2px; padding:20px; font-family: Georgia, "Times New Roman", Times, serif; } .form-style-7 h1{ display: block; text-align: center; padding: 0; margin: 0px 0px 20px 0px; color: #5C5C5C; font-size:x-large; } .form-style-7 ul{ list-style:none; padding:0; margin:0; } .form-style-7 li{ display: block; padding: 9px; border:1px solid #DDDDDD; margin-bottom: 30px; border-radius: 3px; } .form-style-7 li:last-child{ border:none; margin-bottom: 0px; text-align: center; } .form-style-7 li > label{ display: block; float: left; margin-top: -19px; background: #FFFFFF; height: 14px; padding: 2px 5px 2px 5px; color: #B9B9B9; font-size: 24px; overflow: hidden; font-family: Arial, Helvetica, sans-serif; } .form-style-7 input[type="text"], .form-style-7 input[type="date"], .form-style-7 input[type="datetime"], .form-style-7 input[type="email"], .form-style-7 input[type="number"], .form-style-7 input[type="search"], .form-style-7 input[type="time"], .form-style-7 input[type="url"], .form-style-7 input[type="password"], .form-style-7 textarea, .form-style-8 select { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; outline: none; display: block; width: 100%; padding: 7px; border: none; border-bottom: 1px solid #ddd; background: transparent; margin-bottom: 0px; font: 16px Arial, Helvetica, sans-serif; height: 30px; } .form-style-7 input[type="text"]:focus, .form-style-7 input[type="date"]:focus, .form-style-7 input[type="datetime"]:focus, .form-style-7 input[type="email"]:focus, .form-style-7 input[type="number"]:focus, .form-style-7 input[type="search"]:focus, .form-style-7 input[type="time"]:focus, .form-style-7 input[type="url"]:focus, .form-style-7 input[type="password"]:focus, .form-style-7 textarea:focus, .form-style-7 select:focus { } .form-style-7 li > span{ background: #F3F3F3; display: block; padding: 3px; margin: 0 -9px -9px -9px; text-align: center; color: #C0C0C0; font-family: Arial, Helvetica, sans-serif; font-size: 11px; } .form-style-7 textarea{ resize:none; } .form-style-7 input[type="submit"], .form-style-7 input[type="button"]{ background: #2471FF; border: none; padding: 10px 20px 10px 20px; border-bottom: 3px solid #5994FF; border-radius: 3px; color: #D2E2FF; } .form-style-7 input[type="submit"]:hover, .form-style-7 input[type="button"]:hover{ background: #6B9FFF; color:#fff; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script type="text/javascript"> //auto expand textarea function adjust_textarea(h) { h.style.height = "20px"; h.style.height = (h.scrollHeight)+"px"; } </script> </head> <body> <nav class="row"> <a href="https://randogamer.tk/"><div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xs-offset-3 col-sm-offset-3 col-md-offset-3 col-lg-offset-3 inner">INICIO</div></a> <a href="https://randogamer.tk/cliente/clientarea.php"><div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 inner">AREA DO CLIENTE</div></a> <a href="javascript:void(Tawk_API.toggle())"><div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 inner">SUPORTE</div></a> </nav> <br/><br/><br/> <form class="form-style-7" name="loginform" method="post" action="userauthentication.php"> <a3><img src="logou.png"/></a3> <br/><br/> <a2>Usuario:</a2> <input type="text" name="usuario" placeholder="Seu Usuario (Enviado no seu E-mail)"/><br/><br/> <a1>Senha:</a1> <input type="password" name="senha" placeholder="Sua Senha (Enviado no Seu E-mail)"/><br/><br/> <input type="submit" value="Entrar"/></p> </form> </body> <!--Start of tawk.to Status Code--> <script type="text/javascript"> Tawk_API = Tawk_API || {}; Tawk_API.onStatusChange = function (status){ if(status === 'online') { document.getElementById('status').innerHTML = '<a href="javascript:void(Tawk_API.toggle())">SUPORTE</a>'; } else if(status === 'away') { document.getElementById('status').innerHTML = 'We are currently away'; } else if(status === 'offline') { document.getElementById('status').innerHTML = 'Live chat is Offline'; } }; </script> <!--End of tawk.to Status Code --> <!--Start of Tawk.to Script--> <script type="text/javascript"> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; s1.async=true; s1.src='https://embed.tawk.to/57f933088bab9a1c11369b32/1avahogfa'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })(); </script> <!--End of Tawk.to Script--> </html> userauthentication.php <?php require "config.php"; ?> <DOCTYPE html> <html lang="pt-br"> <head> <meta charset="utf-8"> <title>Autenticando... - WebHost RandoGamer</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script type="text/javascript"> function loginsuccessfully() { setTimeout("window.location='painel.php'", 5000); } function loginfailed() { setTimeout("window.location='login.php'", 5000); } for (var i=0; i<15; i++) { var div = document.createElement('div'); div.className = "_" + i + " ball"; div.style.top = ((Math.random() * 115) - 5) + "vh"; div.style.left = ((Math.random() * 115) - 5) + "vw"; document.body.appendChild(div); } </script> <style> body{ margin:0; padding:0; font-family:Arial; font-size:14px; overflow:hidden; background:#fff; } nav{ height:40px; background: linear-gradient(#131313, #2A2A2A); } .inner{ float:left; color:#FFFFFF; text-decoration:none; padding:0 40px; line-height:40px; text-transform:uppercase; text-align:center; } .inner:hover{ background: linear-gradient(#FF822E, #FFA540); } .inner.active{ background:#ff5252; } a1{ animation-duration: 3s; animation-name: slidein; } a2{ animation-duration: 2s; animation-name: slidein; } a3{ animation-duration: 1s; animation-name: slidein; } @keyframes slidein { from { margin-left: 70%; width: 300% } to { margin-left: 0%; width: 100%; } } </style> </head> <body> <?php $usuario=$_POST['usuario']; $senha=$_POST['senha']; $sql = mysql_query("SELECT * FROM usuarios WHERE usuario = '$usuario' and senha = '$senha'") or die(mysql_erros()); $row = mysql_num_rows($sql); if($row > 0) { session_start(); $_SESSION['usuario']=$_POST['usuario']; $_SESSION['senha']=$_POST['senha']; echo "<html><head><style>body {background:#131313;}</style><nav class='row'><a href='https://randogamer.tk/'><div class='col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xs-offset-3 col-sm-offset-3 col-md-offset-3 col-lg-offset-3 inner'>INICIO</div></a><a href='https://randogamer.tk/cliente/clientarea.php'><div class='col-xs-2 col-sm-2 col-md-2 col-lg-2 inner'>AREA DO CLIENTE</div></a><a href='javascript:void(Tawk_API.toggle())'><div class='col-xs-2 col-sm-2 col-md-2 col-lg-2 inner'>SUPORTE</div></a></nav><br/><a1><font color='white'>Sessão iniciada com o usuario ($usuario)</a1><br/><a3>Conectando ao painel...</a3></font></html>"; echo "<script>loginsuccessfully()</script>"; } else { echo "<html><head><style>body {text-align: center;} h1 {font-family: Arial, Helvetica, sans-serif; letter-spacing: -0.1em; font-size: 10em; color: white; x-index: 99;} div {z-index: -99; position: absolute; background: #000000; border-radius: 50%; animation-name: swell; animation-duration: 4s; animation-direction: alternate; animation-iteration-count: infinite;} @keyframes swell { 0% {width: 0vw; height: 0vw; margin-left: 0vw; margin-top: 0vw;} 30% {width: 0vw; height: 0vw; margin-left: 0vw; margin-top: 0vw;} 100% {width: 100vw; height: 100vw; ; margin-top: -50vw;} }</style></head><br/><br/><br/><br/><br/><font color='white' size='8'>Usuario ou Senha inválidos, tente novamente!</font></html>"; echo "<script>loginfailed()</script>"; } ?> </body> <!--Start of tawk.to Status Code--> <script type="text/javascript"> Tawk_API = Tawk_API || {}; Tawk_API.onStatusChange = function (status){ if(status === 'online') { document.getElementById('status').innerHTML = '<a href="javascript:void(Tawk_API.toggle())">SUPORTE</a>'; } else if(status === 'away') { document.getElementById('status').innerHTML = 'We are currently away'; } else if(status === 'offline') { document.getElementById('status').innerHTML = 'Live chat is Offline'; } }; </script> <!--End of tawk.to Status Code --> <!--Start of Tawk.to Script--> <script type="text/javascript"> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; s1.async=true; s1.src='https://embed.tawk.to/57f933088bab9a1c11369b32/1avahogfa'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })(); </script> <!--End of Tawk.to Script--> </html> painel.php <?php require "config.php"; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Painel de Controle - WebHost RandoGamer</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="styles.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> a4{ animation-duration: 5s; animation-name: slidein3; } @keyframes slidein3 { from { margin-left: 50%; width: 300% } to { margin-left: 0%; width: 100%; } } </style> <style tyle="text/css"> div.quadrinho { background: #FFFFE2; border: 1px dashed #bbb; margin-top: 10px; margin-bottom: 10px; padding: 5px; text-align: center; display: block; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } </style> </head> <body> <nav class="row"> <a href="https://randogamer.tk/"><div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xs-offset-3 col-sm-offset-3 col-md-offset-3 col-lg-offset-3 inner">INICIO</div></a> <a href="https://randogamer.tk/cliente/clientarea.php"><div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 inner">AREA DO CLIENTE</div></a> <a href="javascript:void(Tawk_API.toggle())"><div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 inner">SUPORTE</div></a> </nav><br/> <div class=quadrinho><?php echo $usuario; ?> Seja bem-vindo ao Painel WebHost unico da RandoGamer!</div> <br/><br/> <font color="white" size="+3"><a4> Esse site esta em fase de construção!</a4></font> <br/><br/><br/> <a1><font color="white" size="+1"> Porcentagem de construção do Painel WebHost ></font> <progress max="100" value="5"></progress></a1> <?php session_start(); if(!isset($_SESSION["email"]) || !isset($_SESSION["senha"])) { echo "<center><br/><br/><br/><font color='white'>Você não esta logado e não podera ver o resto do conteudo dessa pagina =(</font></center>"; exit; } else { echo "Logado =)"; } ?> <br/><br/> <center><font color='white'>=== Resto da pagina que so apareçe pra quem ta logado =) ===</font></center> </body> <!--Start of tawk.to Status Code--> <script type="text/javascript"> Tawk_API = Tawk_API || {}; Tawk_API.onStatusChange = function (status){ if(status === 'online') { document.getElementById('status').innerHTML = '<a href="javascript:void(Tawk_API.toggle())">SUPORTE</a>'; } else if(status === 'away') { document.getElementById('status').innerHTML = 'We are currently away'; } else if(status === 'offline') { document.getElementById('status').innerHTML = 'Live chat is Offline'; } }; </script> <!--End of tawk.to Status Code --> <!--Start of Tawk.to Script--> <script type="text/javascript"> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; s1.async=true; s1.src='https://embed.tawk.to/57f933088bab9a1c11369b32/1avahogfa'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })(); </script> <!--End of Tawk.to Script--> </html> Oque pode ser? Fiz algo de errado? Compartilhar este post Link para o post Compartilhar em outros sites
mau rs 37 Denunciar post Postado Outubro 18, 2016 Altere este código: $_SESSION['senha']=$_POST['senha']; Ou mude o nome do campo no form ou o nome da session, não deixe o mesmo nome, os dois são 'senha' Compartilhar este post Link para o post Compartilhar em outros sites
Beraldo 864 Denunciar post Postado Outubro 18, 2016 Há vários problemas no código Habilite todas as exibições de erro, como mostrado neste tópico, na Orientação 2. Isso vai mostrar vários problemas Você não salva o email na session, mas verifica o valor dele no if do painel session_start() deve ser chamada antes de qualquer saída ao navegador (echo ou outros códigos HTML). Veja: http://rberaldo.com.br/as-mensagens-de-erros-mais-comuns-do-php/#header Seu código está vulnerável a SQL Injection. Veja: http://rberaldo.com.br/seguranca-em-sistemas-de-login-protecao-contra-sql-injection/ Siga o meu tutorial passo-a-passo sobre sistema de login: http://blog.ultimatephp.com.br/sistema-de-login-php/ PS: funções mysql_* estão obsoletas desde o PHP 5.5 e já foram removidas no PHP 7. Prefira MySQLi ou PDO. Veja mais detalhes aqui: http://rberaldo.com.br/mysql-obsoleto-php/ Compartilhar este post Link para o post Compartilhar em outros sites
RandoMixs 0 Denunciar post Postado Outubro 19, 2016 Altere este código: $_SESSION['senha']=$_POST['senha']; Ou mude o nome do campo no form ou o nome da session, não deixe o mesmo nome, os dois são 'senha' Onde altero isso, qual dos arquivos? Compartilhar este post Link para o post Compartilhar em outros sites
LaerteDias 17 Denunciar post Postado Outubro 19, 2016 Onde altero isso, qual dos arquivos? vai no form e altera o name do campo que recebe a senha e depois altera na variavel $_POST['']. Compartilhar este post Link para o post Compartilhar em outros sites