ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it normal for $_SERVER['HTTP_REFERERE'] to return the value of the previous url and not the one you'r on at the moment?
I have a page that contains links on the left column, each link targets the same page but adds another query to the url. => thus I redraw the same page but with another query.
Then some lines further in the script, it should go looking for this query in the string using $_SERVER['HTTP_REFERER'] to get the CURRENT url and then run a function that takes this query as a parameter to show a photo with the name of this query.
That is, it should do so but for some reason, the $_SERVER['HTTP_REFERER'] variable seems to hold the url of the previous page and thus doesn't show the photo I want but the one I clicked before.
The function gets called from an index page like:
$categ = new category($nm);
$categ->showMe();
Left I have links to photo1, photo2, photo3 (actually links to the same page but with a different query containing the name of the photo)
I open the page 1st time and have the url "http://lieven.isa-geek.net:8123/~lieven/categorytest.php"
I click on the link to the 1st photo (or the second or ...) and I get the url: "http://lieven.isa-geek.net:8123/~lieven/categorytest.php?photo=duik1" but HTTP_REFERER still shows the first one. I click again on a link and it shows the url with that query but then HTTP_REFERER contains the ".../photo=duik1" which is thus the previous one.
PS: If you read Slashdot you'll note that some servers check if your referer is slashdot.org so it stops you to load the page to avoid a flood on the server (any user with some knowledge will solve this in some secs anyway...
Originally posted by gbonvehi Yes.. the referer is where "you came from"
PS: If you read Slashdot you'll note that some servers check if your referer is slashdot.org so it stops you to load the page to avoid a flood on the server (any user with some knowledge will solve this in some secs anyway...
heh, I know /. I have seen those poor bastards being /.etted. and thus being knocked of the net by.. let's call it a DDOS attack. But not with bad intentions ofcourse. (Not like the bastard kids who do this things for fun)
But how can I refer to the current url? Maybe via headers_sent() or something alike? Problem with this headers is that they should be sent before any output is sent to the browser. (I think)
$_SERVER['PHP_SELF'] will tell you the current page. I don't know what you mean by don't having the scheme host and port, maybe this page can help you: http://ar2.php.net/reserved.variables
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.