homepage Welcome to WebmasterWorld Guest from 54.227.141.230
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
how to get referrer from a javascript redirect?
get the referrer url from javascript redirects
David_M




msg:3741583
 12:06 am on Sep 10, 2008 (gmt 0)

I'm trying to limit access to a page to people coming from a specific domain.
However, that domain is using
<script>window.location='http://www.mysite.com'</script>
to do the redirect and i'm using
if (($_SERVER['HTTP_REFERER'] = "http://www.theirsite.com")
to check it- the result, referrer is blank...

Any ideas how to get the referrer even if its a javascript redirect?

 

eelixduppy




msg:3744852
 5:11 am on Sep 15, 2008 (gmt 0)

Don't know if you can. The referrer cannot always be trusted, anyway. Have you found a way around this problem?

David_M




msg:3745023
 2:30 pm on Sep 15, 2008 (gmt 0)

No, had to check on a variable being present to verify. Not as good, but it works...

penders




msg:3745032
 2:40 pm on Sep 15, 2008 (gmt 0)

If the referer is going to be set, it should not matter whether the site is doing a JavaScript redirect, a server-side redirect or the user is clicking a link in the normal way. (?) If the referer is not set, it is likely to be another reason - and out of your control.

Just to note, you only have a single equals (assignment) rather than a comparison (double equals), but then your code would always execute...
if (($_SERVER['HTTP_REFERER'] = "http://www.theirsite.com")

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved