Jump to content

pass server url from site to site


hack4lk

Recommended Posts

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.
Link to comment
Share on other sites

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

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

then go to referral.php and add:

[code]
$referrer = $_GET['ref'];
[/code]

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:

[code]
echo "thank you for visiting our sister site $referrer, please proceed";
[/code]
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.