Jump to content

Archived

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

acroporas

Help with login page / sessions

Recommended Posts

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.

[code]<?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.
[/code]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.  ???

Share this post


Link to post
Share on other sites
[quote author=alpine link=topic=110039.msg444104#msg444104 date=1159592601]
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
[/quote]

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

Share this post


Link to post
Share on other sites
[quote author=Gaoshan link=topic=110039.msg444105#msg444105 date=1159592764]
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.  ???
[/quote]

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.

Share this post


Link to post
Share on other sites

×

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.