Hello friends, I believe this is my first post here. I am having an issue, and I am hoping some of the smart people here will be able to help me.
I have generated some code for our customers to put on their sites, which basically displays our seal of approval. The code is simple Javascript, and it calls an external Javascript file (located on our server), which performs validation based on URL variables passed along with it, and displays the appropriate seal. For example, the code could look like this:
<script language="javascript" src="http://www.mydomain.com/scripts/test.php?var1=abc&var2=def"> </script>
The issue I am running into is this: I want to verify that the website displaying this seal is the actual website it claims to be. I have been unable to find a perfect solution. Here is what I have tried and why it has failed:
1: Keep in mind that I can't put any PHP code in our code that the customers generate, because they may or may not have PHP on their server.
2: $_SERVER['HTTP_HOST'] does not work, because the script itself is on my server, so HTTP_HOST always returns www.mydomain.com, not the domain displaying the script.
3: $_SERVER['HTTP_REFERER'] does not work, because different browsers handle that variable differently. It works pretty well most of the time, but for some reason, my boss doesn't like "pretty well most of the time." 😉
4: We can't use sessions, because it is not good practice to set sessions for your site on another person's site. Makes them mad and whatnot.
5: I considered using an MD5 hash of the domain name and adding it hardcoded as one of the URL variables in the script that they call, but that doesn't really solve the problem. Yes, it ensures that the code is authentic, but it doesn't actually verify that the site displaying the seal is correct.
I am at a loss. If anyone has any ideas, please help me out. I greatly appreciate it.
I guess my great hope is that there is some alternative to HTTP_REFERER that can tell me what page called a script.