Webserver setting: Php version 4.1.2
I am writing a login page by using $_SESSION[].
I tested it on my local computer(localhost), it works fine.
However, when I uploaded to the webserver, it doesn't work propertly. It displayed the error message that what I created "Failed to login, this is a restricted page".
I can login into the first page, when I click the second page links, it can't log me in unless I refresh this page several times.
For example, I have 3 pages, login.php, firstpage.php, and secondpage.php
Code on firstpage.php and secondpage.php
if(!isset($_SESSION['valid_admin'])) {
//Error message if it failed to login.
die("Failed to login, this is a restricted page.");
}
print("Logined successful. <i>Welcome < ".$_SESSION['valid_adm']."> </i>");
I type the username and password on login.php,
I can log in to firstpage.php,
when I click the link of secondpage.php on firstpage.php,
I cannot log in until I clicked the "Refresh" button on IE several times.
I don't know what causes this problem? Is it because my webserver is too slow since this webserver have a lot of traffic?
Did anyone know what happened? Please, help me if you knew the solution.
Thank you,
Raindrop
weird problem?
Moderator: General Moderators
you need to put
on firstpage.php and secondpage.php.
Code: Select all
session_start();-
raindrophk
- Forum Newbie
- Posts: 4
- Joined: Thu Nov 27, 2003 4:07 pm
Simplified my question.
Above message maybe little bit confused, so I am simplified my question.
Why I cannot login in the first time unless I refresh this page several times.
But this page is working fine on my local computer.
Is it because of the traffic of the server. I feel little bit slow on that server. I felt like the session can not created before it checked on my if-statement.
The scene of my problem:
1) Type the username and password on login page, and send it to admin page.
2) Get this error in the first time: "Failed to login, this is a restricted page"
3)Clicked "Refresh" button several times.
4)I can log in. Get this message: Logined successful. Welcome! Admin
code of login validation:
if(!isset($_SESSION['valid_adm'])) {
//Error message if it failed to login.
die("Failed to login, this is a restricted page.");
}
print("Logined successful. <i>Welcome < ".$_SESSION['valid_adm']."> </i>");
Why I cannot login in the first time unless I refresh this page several times.
But this page is working fine on my local computer.
Is it because of the traffic of the server. I feel little bit slow on that server. I felt like the session can not created before it checked on my if-statement.
The scene of my problem:
1) Type the username and password on login page, and send it to admin page.
2) Get this error in the first time: "Failed to login, this is a restricted page"
3)Clicked "Refresh" button several times.
4)I can log in. Get this message: Logined successful. Welcome! Admin
code of login validation:
if(!isset($_SESSION['valid_adm'])) {
//Error message if it failed to login.
die("Failed to login, this is a restricted page.");
}
print("Logined successful. <i>Welcome < ".$_SESSION['valid_adm']."> </i>");
-
raindrophk
- Forum Newbie
- Posts: 4
- Joined: Thu Nov 27, 2003 4:07 pm
Not missed session_start
Thank you for your reply.
I have sesson_start() on all 3 pages.
And, I have a question if i only missed session_start(), how come it work on my local computer and work after I clicked "Refresh" several times.
I have sesson_start() on all 3 pages.
And, I have a question if i only missed session_start(), how come it work on my local computer and work after I clicked "Refresh" several times.
-
raindrophk
- Forum Newbie
- Posts: 4
- Joined: Thu Nov 27, 2003 4:07 pm
?????
No one has the same problem before?
Or nobody knew how to fix this?
Or nobody knew how to fix this?