473,564 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

login then back to the previous page

3 New Member
Hi I am a newbie, and I am having some troubles need someone to help me out. I am currently having a login page.

heres my login form
Expand|Select|Wrap|Line Numbers
  1. <form action="member.php?action=logindo" method="post" id="form_login" name="form_login" >
  2. <input type="text" name="txtloginname" id="txtloginname" tabindex="1"/>
  3. <input type="text" name="txtloginpwd" id="txtloginpwd" tabindex="1"/>
  4. <input name="save" id="save" value="submit">
  5. </form>
How do I write a php page so that if someone login then the page will back to the previous page automatically. (LIKE EBAY)

should I use <input="hidde n" or ['_SERVER']['HTTP_REFERER']??
Nov 2 '08 #1
3 1464
Markus
6,050 Recognized Expert Expert
Have a hidden input on your form that stores the url of the page the form is on (relative or full). Then use the header() function to redirect to the page.
Nov 2 '08 #2
Atli
5,058 Recognized Expert Expert
You could also just use the $_SERVER['HTTP_REFERER'] variable in your "member.php " page.

For example:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Do your login stuff here...
  3.  
  4. header("Location: ". $_SERVER['HTTP_REFERER']);
  5. ?>
  6.  
Note that the HTTP_REFERER is supplied by the client, so this might be used to feed bad URL's in to the redirect. (Although I fail to see how this might be abused for malicious purposes. (but then again, I am not thinking at 100% capacity at the moment :P))
Nov 3 '08 #3
mcmall
3 New Member
Thanks alot guys!!!!
Nov 3 '08 #4

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

Similar topics

4
2203
by: Sniffer-Dog | last post by:
Hi I just wondered if anyone can spot anything wrong with the following? I have now added the session_start(); as the first command in the code to all the pages needing it. When I click on a webpage that is restricted, it takes me to the login page fine. When I login though instead of taking me to the page I clicked previous to that, it...
6
1815
by: Brad Farrell | last post by:
Hi All Definitely a newbie with PHP, though I have messed with it a bit. I could use some guidance here as I have spent the better part of 3 days walking the net looking for an example. Trying to accomplish: When the user goes to the main page, index.html, they can enter a username/password combo to go beyond. When the login button...
5
2959
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 post method and either logs the user in our out given the information from the form. but every pages use sessions and cookies, if the user is...
11
2945
by: David W. Simmonds | last post by:
I have a form that will prompt for a user name/password. In VS.NET, I have the protected form in a folder named Admin. I have a Web.config file in that folder as well. It contains the following section: <authorization> <deny users="?" /> <allow users="*" /> </authorization> In the root folder where the other forms are located I have a...
13
2381
by: Crouchie1998 | last post by:
What's the simplest way to create a login page in ASP.NET & VB.NET? Awaiting your reply, Crouchie1998 BA (HONS) MCP MCSE
4
1960
by: SJ | last post by:
I have a mobile web application running on a server at work. There is a strange thing happening though: 1) I can access and login to my mobile web app from any internet browser. (good thing). 2) I can access and login to my mobile web app from any Palm Treo web browser. (good thing). 3) When I use a regular mobile phone...
5
1399
by: guy | last post by:
I am not a web developer so this is probably easy! in a web app i have a login page if a user logs in, does stuff, logs out - which takes them back to the login page - how do i stop a new user hitting 'back' from the login page and seeing the last page the previous user was looking at (this could be any page in the application)?
6
3333
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in the past in other places, and while the help was much appreciated, it seemed everyone just wanted to 'theoretically' explain how to do it, but when I...
4
3407
idsanjeev
by: idsanjeev | last post by:
sir i am creating a page for logout but problems is here if user is logout and click on standard back button then go on previous page so how can restricted it if user is logout then you don't go back without login <%@ Language=VBScript %> <% Option Explicit %> <html> <head> <meta http-equiv="Expires" content="here goes the present date" />...
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.