473,387 Members | 1,844 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,387 software developers and data experts.

login then back to the previous page

3
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="hidden" or ['_SERVER']['HTTP_REFERER']??
Nov 2 '08 #1
3 1451
Markus
6,050 Expert 4TB
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 Expert 4TB
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
Thanks alot guys!!!!
Nov 3 '08 #4

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

Similar topics

4
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...
6
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. ...
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...
11
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...
13
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
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)...
5
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...
6
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...

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.