Jump to content

Weird Results From Login Script


sweinkauf13

Recommended Posts

Ok. So as you know i'm not sure how my login script is getting a result. Here is my login script and my login.phtml

<?#######################Service Shut-down Switch####################### 1= on  0= off$service_status = "1";######################if($service_status == "0"){header("location: service_down.phtml");exit;}//change varibles$username = "$_POST[username]";$password = "$_POST[password]";////chech for empty variblesIf(($username == "") ||($password == "")){header("location: home.phtml");exit;}////set users//$user = array("user1", "user2", "user3", "user4");////set passwords//$pass = array("pass1", "pass2", pass3", "pass4");////now check for user and start accordinly//if(($username == "$user[0]") &&($password == "$pass[0]")){session_start();$_SESSION[username] = "$user[0]";$_SESSION[password] = "$pass[0]";$_SESSION[login_time] = date("F j,  Y g:i A");////now redirect user//header("location: home.phtml");exit;}else if(($username == "$user[1]") &&($password == "$pass[1]")){session_start();$_SESSION[username] = "$user[1]";$_SESSION[password] = "$pass[1]";$_SESSION[login_time] = date("F j,  Y g:i A");////now redirect user//header("location: home.phtml");exit;}else if(($username == "$user[2]") &&($password == "$pass[2]")){session_start();$_SESSION[username] = "$user[2]";$_SESSION[password] = "$pass[2]";$_SESSION[login_time] = date("F j,  Y g:i A");////now redirect user//header("location: home.phtml");exit;}else if(($username == "$user[3]") &&($password == "$pass[3]")){session_start();$_SESSION[username] = "$user[3]";$_SESSION[password] = "$pass[3]";$_SESSION[login_time] = date("F j,  Y g:i A");////now redirect user//header("location: home.phtml");exit;}else{header("location: no_user.phtml");exit;}?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><title>Family Connection</title><link rel=stylesheet type="text/css" href="style.css"></head><body><div class="login_outline"><br><br><p><center><img src="header_image.gif" alt="Header Image" width="625"></center></p>	<div class="login_body"><p><h4>Welcome To Family Connection! This is the place where you can send messages to family members, mark important dates and alot more. So if your already signed up please login below.</h4></p>	</div>		<div class="login_box">	<form method="post" action="temp_login.php"><p><h2><font color="white"><center>Login</h2></p><p>Username:</p> <p><input type="text" name="user" size="15"></p><p>Password:</p> <p><input type="password" name="pass" size="15"></p><br><p><input type="submit" value="LOGIN"></center></p>	</form>		</div>	<div class="login_footer"><p><align="right"><A HREF="http://www.buttongenerator.com/"><IMG SRC="http://www.buttongenerator.com/ima/link.gif" WIDTH=88 HEIGHT=31 BORDER=0 ALT="ButtonGenerator.com"></A><img src="php-power-black.gif" alt="powered by PHP"> <img src="apache_pb22.gif" alt="powered by Apache 2.2"> <img src="web_stamp_01.gif" alt="Designed By SCPAD"></p>	</div></div></body></html>

So what my script is doing is it is sending me back to my login.phtml when i try and log in. There is only one way that this would happen, if one of the input fields was submitted blank, and when i log in i enter all the correct information. So i'm not sure how it is getting it's result. Is it something with my user and pass arrays? Please help me figure this out.Thank you in advance,Youngwebmaster

Link to comment
Share on other sites

Add session_start() to each page as in login.phtml, home.phtml, and my login.php or as in each section of redirect?

Link to comment
Share on other sites

but then it will automaticly start a session on attempt of login, no matter if the input's blank or inccorect won't it?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...