Jump to content
Sign in to follow this  
marcosvp

login com php pdo

Recommended Posts

galera!! não dar nenhum erro nesse codigo de login + simplesmente ele não logar!!



não sei o que esta dando de errado ja que não informar e nem logar dar !! sempre o echo 'erro ao logar';


agradeco a ajudar!! valeu!!





<h1><i class="icon-signin"></i> Faça o Login</h1>

<div class="login">


<form action="" method="post">

<label for="email">E-mail</label>

<input type="email" name="usuario_email" id="email" placeholder="Digite seu Email" required value=""/>

<label for="senha">Senha</label>

<input type="password" name="usuario_senha" id="senha" placeholder="Digite sua Senha" required value=""/>

<button type="submit" name="salvar"><i class="icon-signin"></i> Entrar</button>

</form>



<?php

if(isset($_POST['salvar'])){


require "modulos/login/funlogin.php";

}

?>


<form class="form-signin" role="form">

<div class="sign">

<div class="row">

<div class="col-md-4 text-center">

<a href="http://mcaprender22.890m.com/auth/twitter" class="icon-button twitter"><i class="icon-twitter"></i><span></span></a>

</div>

<div class="col-md-4 text-center">

<a href="http://mcaprender22.890m.com/auth/facebook" class="icon-button facebook"><i class="icon-facebook"></i><span></span></a>

</div>

<div class="col-md-4 text-center">

<a href="http://mcaprender22.890m.com/auth/google" class="icon-button google-plus"><i class="icon-google-plus"></i><span></span></a>

</div>

</div>

</form>


<a href="#Recuperar" data-toggle="modal" class="esqueceu_senha"> Esqueceu a Senha ?</a>

</div></div></div>

<div class="modal hide fade" id="Recuperar">

<div class="modal-header">

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>

<p id="myModalLabel"><i class="icon-key"></i> Recuperar Senha</p>

</div>

<div class="modal-body">

<form action="<?=URL?>/modulos/recuperar/funRecuperar.php?op=restaura" method="post">

<label for="email">Email</label>

<input type="email" name="usuario_email" id="email_recuperar" placeholder="Digite o seu Email" required=""/>

</div>

<div class="modal-footer">

<button type="submit" class="btn btn-primary" data-loading-text="Carregando...">Enviar</button>

</form>


</div><!--usuario_email-->









<?php

$usuario_email = strip_tags($_POST['usuario_email']);

$usuario_senha = strip_tags($_POST['usuario_senha']);

try {

$select = $pdo->prepare("SELECT * FROM usuario

WHERE usuario_email = ?

AND usuario_senha = ?

");


$select->bindParam(1, $usuario_email);

$select->bindParam(2, $usuario_senha);

$select->execute();


if ($select->rowCount() > 0) {

while ($row = $select->fetchObject()) {


$_SESSION['usuario_id'] = $row['usuario_id'];


echo 'logado com sucesso!';

}

}else{

echo 'erro ao logar';

}

}catch(PDOException $e) {

echo "Erro na linha: {$e->getLine()}";

}

?>

Edited by marcosvp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.