Jump to content

Best Way to Validate Access


n1concepts

Recommended Posts

Hi,

 

I want to control a variable (decide whether to track click if coming from a specific site oppose to hitting the final site (destination) directly.

For example:

 

www.portal.com - this will be a management site that will redirect viewers to the the final destination based on variable info - for exmample $a=123 or $a= 567 - which would come in as www.portal.com?a=123 or www.portal.com?a=567

 

Note: 123 would redirect to www.abc.com?a=123 and/or 567 would redirect to www.xyz.com?a=567 with said variable(s).

------

 

My question is this: What is the best method to authenticate (both on) www.abc.com and/or www.xyz.com that the referred viewer came from www.portal.com?

I know about the super globals (HTTP_REFERER) but want to know if there are other (more) secure method to manage this interaction between external domains /websites?

 

Any insight on this appreciated - thx!

 

Link to comment
Share on other sites

No. Cookies won't work cross domain. There's no reliable way to determine where someone has come from, from what I understand.

 

That would allow any website to view your short-term browsing history.

Link to comment
Share on other sites

Yeah, that's the issue - passing data cross (external) domains. I know it can be done with $_SESSIONS but that's overboard for what I want to accomplish - it's not sensitive information so no problem using $_GET (appending to string to pass along).

 

My only requirement is that I want to acknowledge - from the receiving domains - that the redirect came from that one specific source (www.portal.com) and no other referral or the data capture won't be logged. Reason: this way, I can keep "direct" views from being logged as a hit <they have to originate or coming from www.portal.com>.

 

It looks like "HTTP_REFERER" the option - I will just match on that link.

Link to comment
Share on other sites

The only way it would work with a session/token system would be if the two domains had access to the shared database/filesystem, and the token was passed in the URL.

 

www.xyz.com?a=567&token=*tokenhere*

 

Generally, sessions use cookies which can not cross domains.

 

HTTP_REFERER is the easiest way. Otherwise, you'd need a database both domains have access to, and generate/pass/confirm a token.

Link to comment
Share on other sites

I think I may have a way - using Sessions.

Here's my thinking:

 

PHP makes a name/value pair available in a constant named SID if a cookie value for a session ID cannot be found. To that, I think I may be able to do something like this:

 

<a href="www.abc.com?<?php echo SID; ?>">Testing</a>

 

which should reach the browser as:

 

<a href="www.abc.com?html?PHPSESSIS=xxxxxxxxxxxxxwhich will be the encrypted session xxxxxx">Testing</a>

 

Note: I just have to ensure session_start() defined on the receiving page and this would then be recognized.

Of course, I'll set this as a automatic (timer) redirect but explaining in this format for discussion.

 

I will try this and advise - thx!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.