Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $("#logar").click(function(event) {
- event.preventDefault();
- var email = $('#emailL').val();
- var senha = $('#passwordL').val();
- var url = "<?= base_url("login/autenticar"); ?>";
- $.post(url,{
- email : email,
- async: true,
- password : senha
- }, function(event){
- if(event === "1"){
- $('#erroEmail').html("<img src='<?= base_url('img/l568ECv.gif')?>'' alt='' id='imgLoad'>");
- $('#imgLoad').show();
- setTimeout(function(){
- window.location ="<?= base_url('edit') ?>";
- }, 3000);
- }else{
- $('#erroEmail').html(event);
- }
- });
- });
- </script>
- public function autenticar() {
- $this->load->model("cadastro_model");
- $email = $this->input->post("email");
- $senha = md5($this->input->post("password"));
- $usuario = $this->cadastro_model->buscaPorEmailESenha($email, $senha);
- if($usuario) {
- $this->session->set_userdata("logado" , $usuario);
- echo "1";
- die();
- } else {
- echo "<i class='material-icons alinhaIcone margenIcone'>thumb_down</i>Login or password invalid.";
- die();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement