Jump to content

[SOLVED] Login Issues


timmah1

Recommended Posts

Can anybody tell me why I have to login twice, no matter with this code?

if($_POST['login'])
{


$loginsql = "SELECT * FROM administrators WHERE email = '" . $_POST['email'] . "' AND password = '" . $_POST['password'] . "'";
$loginres = mysql_query($loginsql);
$numrows = mysql_num_rows($loginres);


	if($numrows == 1){				
			$loginrow = mysql_fetch_assoc($loginres);

				if($loginrow['active'] == 1){


					session_register("SESS_LOGGEDIN");
					session_register("SESS_NAME");
					session_register("SESS_EMAIL");

					$_SESSION['SESS_LOGGEDIN'] = 1;
					$_SESSION['SESS_NAME'] = $loginrow['email'];
					$_SESSION['SESS_EMAIL'] = $loginrow['name'];

					//require("header.php");
					header("Location: " . $config_basedir . "index.php");
					//echo "<div align=\"center\"><img src=\"loading.gif\"><br /></div>";
					//echo "<div align=\"center\">Please wait while we log you in<br /></div>";
					//echo "<meta http-equiv=\"refresh\" content=\"2;index.php\">";
				}	
				else {	
				header("Location: " . $config_basedir . "login.php?error=3");
				}

	}
		else {
			header("Location: " . $config_basedir . "login.php?error=2");
		}
	}

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/137703-solved-login-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.