Ch0cu3r Posted December 1, 2014 Share Posted December 1, 2014 So did you comment out the header() lines in login.php? I told you to do this to prevent it from redirecting so we can debug the script. Link to comment https://forums.phpfreaks.com/topic/292829-help-with-mysqli/page/2/#findComment-1498226 Share on other sites More sharing options...
Tom8001 Posted December 1, 2014 Author Share Posted December 1, 2014 // execute query $count= $con->query("SELECT * FROM $tbl_name WHERE username='$username' AND password='$password'"); // check to make sure query did execute. If it did not then trigger error use mysqli::error to see why it failed if(!$count) { trigger_error('Query error: ', $con->error); } else { // get result from query $row = $count->fetch_array(); // output contents of $row printf('<pre>%s</pre>', print_r($row, 1)); $_SESSION['loggedIn'] == true; header("index.php"); } //Admin user level if($row['user_level'] == 1) { $_SESSION['user_level'] == 1; //Location admin header("Location: admin.php"); exit(); } else if($row['user_level'] == -1) { $_SESSION['user_level'] == -1; $_SESSION['username'] == trim($_POST['username']); //Location banned header("Location: banned.php"); exit(); } if($_SESSION['loggedIn'] == true) { //Location default user home page header("index.php"); } //Set default user $_SESSION['loggedIn'] == true; $_SESSION['user_level'] == 1; $_SESSION['username'] == trim($_POST['username']); header("Location: index.php"); exit(); //Kill unwanted session } if(isset($_POST['killsession'])) { session_start(); session_destroy(); echo "Session Destroyed."; exit(); } ?> Link to comment https://forums.phpfreaks.com/topic/292829-help-with-mysqli/page/2/#findComment-1498228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.