homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Passing variable thru redirects
but not in the url
Doood




msg:3784286
 6:37 pm on Nov 11, 2008 (gmt 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?

 

jatar_k




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

what about a cookie?

Doood




msg:3784843
 2:56 pm on Nov 12, 2008 (gmt 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.

jatar_k




msg:3784860
 3:29 pm on Nov 12, 2008 (gmt 0)

you won't always have a referrer but yes that will work when you do

NoLimits




msg:3785253
 11:32 pm on Nov 12, 2008 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved