General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 7th, 2003, 08:09 PM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Question alternative to HTTP_REFERER?

Hello; I just wrote a script that needs to know what the referring page is but "$_SERVER['HTTP_REFERER']" does not seem to be working. Is there a way around this?

Many thanks in advance for your help and code!

Best Regards,
Joe of Christ For Life Ministries
http://www.jc4life.org/
__________________
Check out 4Life today!

Reply With Quote
  #2  
Old October 7th, 2003, 08:56 PM
mwichmann4 mwichmann4 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 80 mwichmann4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 45 sec
Reputation Power: 5
One Idea

You could try adding a get var and passing the name of the page along to the next page. This would work if page names were coming out of a database. $_SERVER var should work though. There might be a prob in the php.ini file. I am not sure why your page would need to know the refering page. Could you explain a bit more of what you are trying to do?

Reply With Quote
  #3  
Old October 7th, 2003, 08:57 PM
mutus mutus is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 6 mutus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
From what I have read, $_SERVER['HTTP_REFERER'] is extremely unreliable and basically useless.... however there may be work-arounds depending on your specific needs and purposes. Care to elaborate?

Reply With Quote
  #4  
Old October 9th, 2003, 04:04 PM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Well, my project is rather hard to explain. The reason that I can not just use a variable is because of the way my site is set up. I use Apache's Mod-Rewrite module to make the pages look like a directory structure - this is to be more search engine friendly. For example, "main.php" would be accessed as "/main/". To add a whole nother url to that would not only cause potential problems but ruin the simplicity and beauty of the directory-like structure previously mentioned.
An instance where I would need to know what the previous page was appears in my Customization page. This page allows visitors to change various things on the page and allow them to apply those settings to either the referring page or the entire site.
While writing this post, I did come up with an idea of how to do this in JavaScript but that would leave my non-JS users out in the cold. In comforming both with accessibility standards and other web standards, I need to support those people too. A big example of this once again comes from the Customization page. In JS-enabled browsers this page will be opened in a new window but instead of using the window command in the HREF I use it in the onClick attribute and the provide the actual link in the HREF.
Well, I apologize for the length of this post, but I hope that now understand my dilema!

Many thanks for your help in advance!

Joe

Last edited by Joe4JC : October 10th, 2003 at 06:15 AM.

Reply With Quote
  #5  
Old October 10th, 2003, 12:34 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Sounds like you are running PHP in cgi mode... If you want a quick fix, avoid using the CGI version. If this is not an option with your current host, change your host.

On another note, you could just use sessions and record the current location which would be useable on each page view.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #6  
Old October 10th, 2003, 06:14 AM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Nope, I am using PHP in module mode (the correct term?). I do not have the option of switching hosts since I just signed up with them. The thing with sessions, though, is, because of their setup or something, the "PHPSESSID=" gets apended to the URL. Thanks, anyhow!

Joe

Reply With Quote
  #7  
Old October 10th, 2003, 06:57 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Have you tried getenv("HTTP_REFERER")? I'm not sure that's any more reliable than using the $_SERVER variable, but I've never had problems with it.

Reply With Quote
  #8  
Old October 10th, 2003, 11:47 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
PHP Code:
 because of their setup or somethingthe "PHPSESSID=" gets apended 
Setup sessions to use only cookies then. This does away with people who have cookies turned off, but then again there truly aren't that many people with cookies off.

Reply With Quote
  #9  
Old October 10th, 2003, 02:46 PM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Thank you guys for your suggestions but I still have found no solution. Dhouston, here is a quote from PHP.net in reference to "getenv":
Quote:
Note: This function does not work in ISAPI mode.


Joe

Reply With Quote
  #10  
Old October 10th, 2003, 02:54 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
If you wanted to get really bizarre-fancy, you could store the last page visited in session variable or a cookie and redirect to that. For every page but the page that has to do the processing, you'd write the session variable, and then when you ran the script in question, you'd test for that variable. Since you're not overwriting the session variable with the URL of the script in question, it won't overwrite what was last set, so you'll effectively have the referer. This assumes you're wanting to ensure that somebody's coming from a page on your site, though, which may not be what you want to do at all.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > alternative to HTTP_REFERER?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway