I’ve got a page under http://www.example.com/abc/def/a/ where a user can buy products.
For a marketing activity (printed paper) the customer should type in a shorter url
http://www.example.com/order/
When this url is called, the server executes this script:
<?php
header("Location: http://www.example.de/abc/def/a/");
exit;
?>
The page under http://www.example.com/abc/def/a/ contains some
informations (rebate-code etc.) which should only be visible to users
coming from http://www.example.com/order/
$_SERVER['HTTP_REFERER'] seems to be not reliable from what I’ve read.
I checked with phpinfo(); if there is any info variable which contains “order” but I haven’t found one.
Is it possible or do you recommend an alternative approach?
HTTP is in it’s pure form a stateless-protocol, so you won’t find anything in the protocol itself that will help you with your current problem.
Using
$_SESSIONto store data in-between requests is the easiest route to walk, and what I recommend.As said; since the protocol used to transfer information is stateless you have no choice but to create a method for your web-application to recognize which request is done by which user.. this is a perfect problem solved by php-sessions.