phpSensei Posted November 10, 2007 Share Posted November 10, 2007 Alright, this is a login validation thing. When leaves the field empty, things redirect to right page. But when the login is a success, the page would not budge. Its like a blank page with nothing in it. i even tried to echo something outside of the if/else, and still nothing. why wont it redirect? NO ERRORS COME UP BTW. <?php include("../config/connection.php"); // Set the connection file //include our session handling file, make sure you have the right file name session_start(); $action = $_GET['mode']; switch($action){ case 'login': $username = trim($_POST['username']); $password = trim(md5($_POST['password'])); $cookie = $_POST['autologin']; $redirect = $_POST['redirect']; if(($username == "")||($password == "")){ header("LOCATION: ".$redirect."?error=001"); } else { $username = strip_tags($username); $password = strip_tags($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $row=mysql_fetch_array(mysql_query("SELECT * FROM ap_users WHERE ap_username = '$username' and ap_password = '$password'")) or die(mysql_error()); if(($row['ap_username']==$username)&&($row['ap_password']==$password)){ if(isset($cookie)){ ///////////////////////////////////// setcookie("ap_user",$username,time()+1000000000000000000000000000); setcookie("ap_id",$row['ap_id'],time()+1000000000000000000000000000); setcookie("session_logged_in",true,time()+1000000000000000000000000000); header("LOCATION: ".$redirect); }// end if cookie isset //////////////////////////////////////// else { $_SESSION['username']==$username; $_SESSION['user_id'] == $row['ap_id']; $_SESSION['session_logged_in']== true; header("LOCATION: ".$redirect); } ///////////////////////////////////////// }// end if password and username are correct else { header("LOCATION: ".$redirect."?error=002"); }// end if username or password dont exsist }// end else break; }// and case ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.