Forum Moderators: coopster
The problem is, I don't know how to use "mid" essentially in PHP.
The returned values are:
$_SERVER["HTTP_REFERER"];
- [mydomain.com...]
$_SERVER["HTTP_HOST"];
www.mydomain.com
How would I do that?
Thanks
A referrer cannot entirely be trusted.
Maybe if I knew a little more about why you are doing this I can find an alternate solution that is a little more reliable.
Basically, I want to link to a site without actually linking to it, so I have the following in my .htacccess:
RewriteRule ^offsite/([A-Za-z0-9_\ %\.\\-]+)$ redirect.php?site=$1
which will take any url, such as:
[mysite.com...]
and pass it to redirect.php?site=thissite.com
redirect was going to(prior to my finding out it wouldn't always work) check the referrer and make sure it matched the host, so people can't just type in any url, it had to be coming from my site.
How else would you recommend I do this?
You could probably set up a cookie-based system to only allow the redirect if the user has been to a referring page within the last hour or two. It would take some work, though.
Or for another solution, you could store all of the links in a database, and refer to them with a code, like TinyURL does. That might be harder to maintain, but it would be most secure.
I would need an encyption alg. that others don't have access to. I guess I could md5 a text string with a timestamp, but that seems silly, really.
Any suggestions on the best way to implement the code version? (I would prefer a 4-5 digit code, if it has to be in the URL itself. such as:
mysite.com/offsite/yoursite.com?f49Kd