22.03.2018, 13:35
Alguem pode me ajudar com esse problema que estou tendo na ucp, Tipo eu coloco as informaзхes todas certinhas so q ela fica toda hora dando invalido
Verificar.php
index.php
Verificar.php
PHP код:
<?php
session_start();
include_once("conexao.php");
if((isset($_POST['username'])) && (isset($_POST['password']))) {
$login = mysqli_real_escape_string($conn, $_POST['username']); // Prevenзгo de SQL Injection
$senha = mysqli_real_escape_string($conn, $_POST['password']);
$sql = "SELECT * FROM ucp_users WHERE username = '$login' && password = '$senha' LIMIT 1";
$result = mysqli_query($conn, $sql);
$resultado = mysqli_fetch_assoc($result);
if(empty($resultado)) {
$_SESSION['loginError'] = "Usuбrio ou senha invбlidos";
header("Location: ../index.php");
} elseif(isset($resultado)) {
$_SESSION['username'] = $resultado['username'];
$_SESSION['password'] = $resultado['password'];
header("Location: ../pages/inicio.php");
} else {
$_SESSION['loginError'] = "Usuбrio ou senha invбlidos";
header("Location: ../index.php");
}
} else {
$_SESSION['loginError'] = "Usuбrio ou senha invбlidos";
header("Location: ../index.php");
}
?>
PHP код:
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>C90:RP | User Control Panel</title>
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Sweet Alert -->
<link href="assets/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<link href="assets/css/animate.css" rel="stylesheet">
<link href="assets/css/style.css?rel=1" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="loginColumns animated fadeInDown">
<div class="row">
<div class="col-md-6" style="margin: 0 25% 0 25%">
<div class="login-logo">
<a href="">City of 90<b style="color:#C1033B">RP</b></a>
</div>
<div class="ibox-content">
<center>Entre em sua conta</center>
<form class="m-t" id="formlogin" role="form">
<div class="form-group">
<span class="fa fa-user"></span>
<input id="user-login" type="text" class="form-control" placeholder="Usuбrio" required="">
</div>
<div class="form-group">
<span class="fa fa-lock"></span>
<input id="user-senha" type="password" class="form-control" placeholder="Senha" required="">
</div>
<div class="row">
<div class="col-xs-8">
</div>
<div class="col-xs-4">
<button type="submit" class="btn btn-success btn-block btn-flat"><i class="fa fa-check"></i> Login</button>
</div>
</div>
<div class="text-muted text-center">
<p>OU</p>
<a class="btn btn-sm btn-primary btn-block" href="registro">Crie uma nova conta</a>
</div><br />
<a href="#">Esqueci minha senha</a>
</form>
<hr />
<center><a href="forum"><i class="fa fa-globe"></i> Fуrum</a> | <a href="#"><i class="fa fa-home"></i> Inнcio</a><br /><br />
<font size='-2'>Copyright © 2017-2018 - City of 90 RolePlay<br /><a href="https://www.********.com/">Gabriel Silva</a></font></center>
<br />
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<script src="assets/js/jquery-2.1.1.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="assets/js/inspinia.js"></script>
<script src="assets/plugins/pace/pace.min.js"></script>
<!-- Sweet alert -->
<script src="assets/plugins/sweetalert/sweetalert.min.js"></script>
<script>
$(document).ready(function () {
$('#formlogin').submit(function(){ //Ao submeter formulбrio
swal({
title: "Login",
text: "Autenticando usuбrio, aguarde um momento..",
});
setTimeout(function(){
var login=$('#user-login').val(); //Pega valor do campo email
var senha=$('#user-senha').val(); //Pega valor do campo senha
//var senhahash=$('SenhaShow').val();
$.ajax({ //Funзгo AJAX
url:"config/autentica.php", //Arquivo php
type:"post", //Mйtodo de envio
data: "login="+login+"&senha="+senha, //Dados
success: function (result){ //Sucesso no AJAX
//alert(result);
if(result==1){
swal("Login!", "Vocк logou-se com sucesso.", "success")
setTimeout(function(){ window.location = '../pages/inicio.php'; }, 1000);
}else{
swal("Login", "Usuбrio ou senha invбlido. ", "error");
}
}
})
return false; //Evita que a pбgina seja atualizada
},1200)
return false;
})
});
</script>
</body>
</html>