Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 01-27-2006, 01:04 AM   #1 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
A request from IRC regarding HTTP_REFERER

As you all know I've been away for quite some time now, but good news, starting from february 16. I'm getting an internet connection again.

Anyway Just noticed one request from #codenewbie@freenode.net since apparently my user is the only one idling there, I might aswell bring it here:
Quote:
< lobas> redhead
< lobas> <html>
< lobas> <head>
< lobas> </HEAD>
< lobas> <meta http-equiv="refresh" content="0; url=<?php $HTTP_REFERER?>">
< lobas> </body>
< lobas> </html>
< lobas> why dont that work
And the answer is, you have to somehow serve the contense which is hold in HTTP_REFERER to the browser, usualy this is either done by using print() or by using echo, so in your case it would be:
HTML Code:
<html>
 <head>
  <meta http-equiv="refresh" content="0; url=<?php echo $HTTP_REFERER; ?>">
 </HEAD>
 <body>
 </body>
</html>
Thanks for listening all, and please shower this poor lobas with all the solutions you can come up with
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001

Last edited by redhead; 01-27-2006 at 02:54 AM.
redhead is offline   Reply With Quote
Old 01-29-2006, 12:59 PM   #2 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Alternate version:
Code:
< lobas> <meta http-equiv="refresh" content="0; url=<?=$HTTP_REFERER?>">
idx is offline   Reply With Quote
Old 01-29-2006, 04:06 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,503
sde is on a distinguished road
i would ask him to view source to make sure it's printing the meta refresh url accurately. might want to try a value of 1 second instead of 0 too. the code looks good.

alternatively, if he doesn't want this handler page to show at all, .. he could do whatever he needs to, then call a header redirect with php.
PHP Code:
<?
// do whatever php logic here.
// don't print anything to the screen before this command
// since it is a header command.
header("location: " $HTTP_REFERER);
exit;
?>
sde is offline   Reply With Quote
Old 01-30-2006, 01:34 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,503
sde is on a distinguished road
something else i just thought of. if he isn't seeing the uri in the 'view source', he could try using: $_SERVER['HTTP_REFERER'] instead.
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IRC Channel ender Lounge 2 11-23-2005 06:56 PM
error in file request cancelled by user achonk81 MS Technologies ( ASP, VB, C#, .NET ) 2 09-20-2005 08:42 PM
sending an xml request sde PHP 3 09-25-2003 12:38 PM
getting an irc channel? Apodysophilia Lounge 5 07-08-2003 04:38 PM
IRC Connection Protocol... abc123 All Other Coding Languages 9 06-16-2002 11:10 PM


All times are GMT -8. The time now is 11:22 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting