rawky1976 Posted February 21, 2007 Share Posted February 21, 2007 Hi all, DW has created the following but it always re-directs to the loginFailure page! Any ideas why? <?php require_once('Connections/connKB.php'); ?> <?php mysql_select_db($database_connKB, $connKB); $query_rsUsers = "SELECT username, password FROM users"; $rsUsers = mysql_query($query_rsUsers, $connKB) or die(mysql_error()); $row_rsUsers = mysql_fetch_assoc($rsUsers); $totalRows_rsUsers = mysql_num_rows($rsUsers); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "loggedInIndex.php"; $MM_redirectLoginFailed = "loginFailure.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_connKB, $connKB); $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $connKB) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> Thanks to anyone that can help!!! Mark Link to comment https://forums.phpfreaks.com/topic/39538-login-redirect/ Share on other sites More sharing options...
rawky1976 Posted February 21, 2007 Author Share Posted February 21, 2007 Fixed! I re-created the database with the users table: - TYPE = MyISAM; instead of: - TYPE = INNODB; Does anyone know why this would make a difference? Link to comment https://forums.phpfreaks.com/topic/39538-login-redirect/#findComment-190812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.