Jump to content


Photo

pass server url from site to site


  • Please log in to reply
2 replies to this topic

#1 hack4lk

hack4lk
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 01 March 2006 - 09:57 PM

Hello everyone, I was just wondering if there is a way to pass the main server url from one site to another because I would like to build a simple referral system that when someone clicks on a referral link in www.site1.com/sample.html , they are redirected to www.site2.com/referral.php, which catches the first url and says something like "thank you for visiting our sister site www.site1.com, please proceed".

I know that I can use $_SERVER to hold the variable locally but how do i pass that through a url and strip away everyting but the server url....thanks a lot in advance.

#2 Hooker

Hooker
  • Members
  • PipPipPip
  • Advanced Member
  • 193 posts
  • LocationWales, UK

Posted 02 March 2006 - 06:45 AM

change sample.html to sample.php to start, then where you link to the seconds site simply add:

http://www.site1.com/referral.php?ref=site1

then go to referral.php and add:

$referrer = $_GET['ref'];

Then still in referral.php wherever you want it to say "thank you for visiting our sister site www.site1.com, please proceed" just add:

echo "thank you for visiting our sister site $referrer, please proceed";


#3 hack4lk

hack4lk
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 March 2006 - 02:52 PM

Thanks...it works great!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users