October 19, 201411 yr Hello Friends,I have a project where am making the login form a popup box of javascript. My javascript will alert if email or password is missing but i need to check my database to be sure the email and password are correct beforre redirecting the member to member Page.I am not so good in javascript but better in PHP below are my scripts $(document).ready(function() { $("#login #cancel").click(function() { $(this).parent().parent().hide(); }); $("#onclick").click(function() { $("#logindiv").css("display", "block"); }); $("#contact #cancel").click(function() { $(this).parent().parent().hide(); }); // Login form popup login-button click event. $("#loginbtn").click(function() { var login_email = $("#login_email").val(); var login_pword = $("#login_pword").val(); if (login_email == "" || login_pword == ""){ alert("Email or Password was Wrong"); }else{ $.ajax({ type:'POST', url:'login_pop.php', }); } }); }); below is 'login_pop.php' <?php ob_start(); session_start(); include("joined/attach_source.php"); $login_email = stripslashes($_POST[login_email]); $login_pword = stripslashes($_POST[login_pword]); $pw = hash('sha512', $pword); //hashing the password //check if the email already exist else{ $check = mysqli_query($syntaxit, "SELECT * FROM members WHERE member='$email' && pword='$pw' "); if(mysqli_num_rows($check) < 1) {header("location:login.php?issue=This+Email+or+Password+does+not+exist");} else{ $result = mysqli_fetch_array($check);{ $confirm = $result[confirmation]; $status = $result[status]; $act_key = $result[activation_code]; } if($confirm!='1') {header("location:login.php?issue=You+have+not+confirmed+your+registration");} elseif($status!='Active') {header("location:login.php?issue=Your+Account+has+been+deactivated.+Contact+Us+for+detail");} else{ //UPDATE LAST VISIT TABLE $get = mysqli_query($syntaxit, "SELECT cur_date, cur_time FROM logins WHERE member='$email'"); $row = mysqli_fetch_array($get);{ $date = $row[cur_date]; $time = $row[cur_time]; } $update = mysqli_query($syntaxit, "UPDATE logins SET cur_date='$cur_date', cur_time='$cur_time', last_date='$date', last_time='$time' WHERE member='$email'"); $_SESSION[memkey] = $act_key; header("location:cpanel/home.php"); } } } ?> the problem is that, once the email and password are entered, the popup window will just disappear with checking or redirect them to the member's page.pls help.
Create an account or sign in to comment