need help with user authentification
Posted: Fri Feb 27, 2009 6:17 pm
Bear with me, I am completely new to this.
Here's what I need to do:
I am creating a pdf file that will contain an affiliate link. Say: "hop.beans.'variable'.com"
The link will redirect to "example.com"
I need to make "example.com" only accessable if clicked through the affiliate link otherwise return 404 error.
The purpose of this is to show affiliates that their commission can't be lost by someone following the link and then going to "example.com" in attempts to refuse the referral.
I found the following code which seems to be what I am looking for. Yet, I still don't know how to implement it. Do I just replace 'secret key' and 'secret value' with something in the affiliate link?
Travis
Here's what I need to do:
I am creating a pdf file that will contain an affiliate link. Say: "hop.beans.'variable'.com"
The link will redirect to "example.com"
I need to make "example.com" only accessable if clicked through the affiliate link otherwise return 404 error.
The purpose of this is to show affiliates that their commission can't be lost by someone following the link and then going to "example.com" in attempts to refuse the referral.
I found the following code which seems to be what I am looking for. Yet, I still don't know how to implement it. Do I just replace 'secret key' and 'secret value' with something in the affiliate link?
Thanks for the help!This very simple technique can be used if you want to restrict access to the PHP script and do not want to write much code. You can get access to your script by supplying arbitrary additonal parameter within the script URL, e.g.: http://www.yoursite.com/mystats.php?sec ... ecretvalue. Without this parameter you can return 404 HTTP (Page Not Found) response code as described below.
<?php
//This function returns True if query string contains secretkey and secretvalue.
//Otherwise it returns False
function CheckAccess()
{
return @$_GET['secretkey']=='secretvalue';
}
?>
Travis