Welcome to WebmasterWorld Guest from 54.146.201.80

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Passing variable thru redirects

but not in the url

     
6:37 pm on Nov 11, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 4, 2002
posts: 187
votes: 0


Can you pass variables using a redirect without a form, without a session and without the variable being in the url?

Say you link to my site using a url like
example.com?id=123
then while on my site you click on a link but that link goes thru a GeoIP script that see you're from a blocked country and redirects you to
example.com/blocked/country.php
then this page will check to see if an id is set and base further actions on if it's set or not.

Problem is, on example.com/blocked/country.php it can't get the id variable unless it's in the url.

Is that right? Or is there another way I'm not thinking of?

8:30 pm on Nov 11, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


what about a cookie?
2:56 pm on Nov 12, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 4, 2002
posts: 187
votes: 0


Since the referring url still has the id code I want then I just did it like this and it works.


$ref = $_SERVER['HTTP_REFERER'];
$string = strstr($ref,"id=");
$ref = str_replace("id=","",$string);
echo $ref;

and it returns just the id number like I want. I'm not sure if it's the best way to do it but it works.
3:29 pm on Nov 12, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


you won't always have a referrer but yes that will work when you do
11:32 pm on Nov 12, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 2, 2005
posts:501
votes: 0


I think php sessions is what you're looking for.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members