473,387 Members | 1,541 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.

Log In Page that goes back to REFERRING page

Hi,
I am using the following code to initialise a session, depending on
whether-or-not the users' log in attempt has been successful.

if ($session_ok == "TRUE") {
//open the session
session_start();
//assign user details to session
$_SESSION[txt_user] = $user_id;
$_SESSION[user_pass] = $user_pass;
$_SESSION[ses_state] = "TRUE";
header("Location: ../index.php");
}

as you can see the script then refers back to my index.php page, after the
session is ok'd.

What I would like to do is change this so that is goes back to the referring
page, instead of the index.php page, which requires the user to then
navigate to their previous page again.

I have attempted to use $HTTP_REFERER, although for me (on IE6) for some
reason their is no value in the variable!

Any help appreciated!

Thanks.

Jul 17 '05 #1
3 4419
jn
"Steve Macleod" <st********@leodhotmail.com> wrote in message
news:h4**************@news-binary.blueyonder.co.uk...
Hi,
I am using the following code to initialise a session, depending on
whether-or-not the users' log in attempt has been successful.

if ($session_ok == "TRUE") {
//open the session
session_start();
//assign user details to session
$_SESSION[txt_user] = $user_id;
$_SESSION[user_pass] = $user_pass;
$_SESSION[ses_state] = "TRUE";
header("Location: ../index.php");
}

as you can see the script then refers back to my index.php page, after the
session is ok'd.

What I would like to do is change this so that is goes back to the referring page, instead of the index.php page, which requires the user to then
navigate to their previous page again.

I have attempted to use $HTTP_REFERER, although for me (on IE6) for some
reason their is no value in the variable!

Any help appreciated!

Thanks.


Did you try $_SERVER['HTTP_REFERER']?
Jul 17 '05 #2
duh

thats working ok now

many thanks!
"jn" <us********************************@jasonnorris.ne t> wrote in message
news:32*********************@twister.tampabay.rr.c om...
"Steve Macleod" <st********@leodhotmail.com> wrote in message
news:h4**************@news-binary.blueyonder.co.uk...
Hi,
I am using the following code to initialise a session, depending on
whether-or-not the users' log in attempt has been successful.

if ($session_ok == "TRUE") {
//open the session
session_start();
//assign user details to session
$_SESSION[txt_user] = $user_id;
$_SESSION[user_pass] = $user_pass;
$_SESSION[ses_state] = "TRUE";
header("Location: ../index.php");
}

as you can see the script then refers back to my index.php page, after the session is ok'd.

What I would like to do is change this so that is goes back to the

referring
page, instead of the index.php page, which requires the user to then
navigate to their previous page again.

I have attempted to use $HTTP_REFERER, although for me (on IE6) for some
reason their is no value in the variable!

Any help appreciated!

Thanks.


Did you try $_SERVER['HTTP_REFERER']?

Jul 17 '05 #3
"Steve Macleod" <st********@leodhotmail.com> wrote in message news:<h4**************@news-binary.blueyonder.co.uk>...
Hi,
I am using the following code to initialise a session, depending on
whether-or-not the users' log in attempt has been successful.

if ($session_ok == "TRUE") {
//open the session
session_start();
//assign user details to session
$_SESSION[txt_user] = $user_id;
$_SESSION[user_pass] = $user_pass;
$_SESSION[ses_state] = "TRUE";
header("Location: ../index.php");
}

as you can see the script then refers back to my index.php page, after the
session is ok'd.

What I would like to do is change this so that is goes back to the referring
page, instead of the index.php page, which requires the user to then
navigate to their previous page again.

I have attempted to use $HTTP_REFERER, although for me (on IE6) for some
reason their is no value in the variable!


Wrong idea. What if the referrer page is other than your site?

The correct idea is to track the current url of the page in cookie.
So, while logining just check if that cookie is set; if it is set then
redirect to that page.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike Brearley | last post by:
I was wondering if there was an easy way to have a form set up so that when the submit button is pressed, it goes to a confirmation page that contains a back button that goes back to the page that...
6
by: Rich | last post by:
Am just beginning to use javascript. I have some pages that can be arrived at from more than one other page. Yes, the user can use the back button but I'd like to have a back link at the bottom...
2
by: VB Programmer | last post by:
I created a page which I am using to prevent the user from hitting the BACK button. I'll call it my "Auto Jump" page. When it is called it basically auto-redirects to a page specified in the...
2
by: buran | last post by:
Dear ASP.NET Programmers, I want to store the referring page of an .aspx page so that I can redirect the user back to the referring page if needed. I am using the following code snippet but...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
3
by: Emily | last post by:
I have three asp pages. The initial page is login.asp, it goes to page hello.asp. And hello.asp goes to page another.asp. If it goes back from hello.asp to login.asp, then in Internet Explorer,...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: pbd22 | last post by:
can somebody tell me how to set a parameter of my current URL without using response.redirect? I am trying to set a parameter - ResponseId = 4 inside a while loop. is this possible? also,...
3
by: Husain | last post by:
Hello. I have a button on a form which goes to a function validate in javascript as shown below: <input type="button" name="<%= i%>" value="Edit" onclick="validate(this.name)"> The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.