473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

i have a problem with my login page

123 100+
i have two page the login page(login.php) and the userpanel page(userpanel.php)
in the login page whenever i put in the username and password then i click submit
it will get the userpanel page but the problem is whenever i am in the userpanel page and i click the back option on top of the browser it will take me back to the login page how can i fix this problem
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3. login.php
  4. session_start();
  5.  
  6. if(isset($_GET['try'])) {
  7.  
  8.     If(empty($_POST['username']) OR empty($_POST['password'])) {
  9.  
  10.         echo 'Please fill in all the required fields';
  11.  
  12.     } else {
  13.  
  14.         $username = mysql_real_escape_string($_POST['username']);
  15.         $password = md5($_POST['password']);
  16.  
  17.         $query = mysql_query("SELECT id FROM account
  18.                        WHERE username = '" . $username . "' 
  19.                        AND password = '" . $password . "'
  20.                       ") or die(mysql_error());
  21.  
  22.         list($user) = mysql_fetch_row($query);
  23.         if(empty($user)) {
  24.  
  25.             echo 'No combination of username and password found';
  26.  
  27.         } else {
  28.  
  29.             $_SESSION['user'] = $user;
  30.             header('location: userpanel.php');
  31.  
  32.         }        
  33.  
  34.     }
  35.  
  36. }
  37. ?>
  38.  
May 9 '09 #1
1 1468
Markus
6,050 Expert 4TB
Why is this a problem? People frequently make an issue out of this when there isn't an issue, much like the 'logged out, but can still press back button to view pages.'

Pages are stored in a browsers cache to make page loading faster and to provide the back and forward button feature, but that is all they're seeing: a cached page. If a user where to then try some functionality on the page, e.g., clicking a link, etc., providing you had the correct validation measures in place, you would be able to see that the user isn't logged in (or is) and take the appropriate action.

Mark.
May 9 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page...
1
by: RT | last post by:
I have followed the step by step instructions in the login manual Created login page Use LSC01 This works - login and get redirected to the proper page My problem is the cookie variables...
5
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a...
3
by: Bob Mariotti | last post by:
Please bear with me as I am not a skilled html programmer. I have a situation that I am having difficulty overcoming and perhaps you "experts" can show me the way. I have a given web site where...
1
by: Tom Jones | last post by:
Hi, I am using the HttpWebRequest and HttpWebResponse classes to pull information from a web server on the internet. I have an account on one of the webservers that I need to log into...
4
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I would like to add a second, different login page for...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
8
by: zdp | last post by:
Hello! I need to process some webpages of a forum which is powered by discuz!. When I login, there are some options about how long to keep the cookies: forever, month, week, et al. If I choose...
0
by: Sergio E. | last post by:
Hello, I have a problem with masterpages and forms security. I made a new Web site, in which I have my page of login like of beginning, a master page with only a sitemappath object in it, the...
0
by: arizal | last post by:
Hi , I am having problem with log in and log out . I have a main login page where one can login with the username and password stored in mysql database. <?php session_start(); //ob_start();...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.