Jump to content


Photo

Help with login page / sessions


  • Please log in to reply
5 replies to this topic

#1 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 30 September 2006 - 03:50 AM

Can you see what's up with this?

Even when I enter the correct username and password, the script does not jump pass the form.

<?php

session_start();

if ( $POST['login'] == "iamme" && $_post['pasword'] == "saysme" )
	$_SESSION['logged'] = "yes";


if ( $_SESSION['logged'] != "yes" )
{
?>

<html>
<head>
<title>Login</title>
</head>

<body>

<form action="index.php" method="post" >

  <p style="margin-top: 0; margin-bottom: 0"><b><font size="4">Domain.com</font></b></p>
  <p style="margin-top: 0; margin-bottom: 0">Login in to access admin page.</p>
  
<?php 

if ( ( $_POST["login"] != "iamme" && $_POST["login"] ) || ( $_POST["pasword"] != "saysme" && $_POST["pasword"] ) )
	echo '<p style="margin-top: 0; margin-bottom: 0">Username or password was incorrectly entered.</p>';
?>

  <p>&nbsp;</p>
  
  Login:     <input type="text" name="login" size="20"></p>
  
  Password:  <input type="password" name="pasword" size="20"></p>
  
  <p>&nbsp;</p>
  
  <p><input type="submit"></p>
</form>

</body>

</html>

<?php

die("");

}
?>
password was good.


#2 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 30 September 2006 - 05:03 AM

You will need to refresh the page one time or move to another page for the session to be readable, same thing as with cookies

#3 Gaoshan

Gaoshan
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 30 September 2006 - 05:06 AM

By "jump pass the form" do you mean you want the form to load some other page and it doesn't or do you want the form to reload the same page and it doesn't? Not clear what you want to do.  ???

#4 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 30 September 2006 - 01:54 PM

You will need to refresh the page one time or move to another page for the session to be readable, same thing as with cookies


I tryed it where it moves to new page, still does not work.

#5 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 30 September 2006 - 01:59 PM

By "jump pass the form" do you mean you want the form to load some other page and it doesn't or do you want the form to reload the same page and it doesn't? Not clear what you want to do.  ???


overview of code

If ( $_session['login']!=yes )
{
display login page
submit goes back to same page
}
else

"password was good"

The problem is that even when the password is good, it still shows the login page.

#6 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 30 September 2006 - 08:03 PM

Ok I found the problem.  $POST != $_POST

Duh...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users