GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Referral Link Rotation (https://gfy.com/showthread.php?t=481491)

propromotions 06-16-2005 09:21 AM

Referral Link Rotation
 
Does anybody know of a script that will rotate links? For example, user 1 clicks on a link and takes them to tour A. user 2 clicks the link and takes them to tour B.

Thanks for any and all help.

wallst 06-16-2005 09:22 AM

wish i could help - i could use a good banner rotator myself.

propromotions 06-16-2005 09:27 AM

its gotta be sorta like a banner rotater i guess. the only different is your clicking text and not image.

kernelpanic 06-16-2005 09:28 AM

Just find one of the endless free ad rotators and modify it to output text links instead of IMG tags

SmokeyTheBear 06-16-2005 09:30 AM

Quote:

Originally Posted by wallst
wish i could help - i could use a good banner rotator myself.

view-source :) gfy's isnt exactly custom..

Alex 06-16-2005 09:32 AM

Do you need it to rotate text links? Or just the actually URL?

If its the actually URL a simple php OUT script can be coded

SmokeyTheBear 06-16-2005 09:38 AM

heres a simple text or image banner rotation
Code:

<!----Main Banner Rotation--------

var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) hahahaha 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }

var winl = (myWidth - 624) / 2;
var wint = (myHeight - 600) / 2;

n=new Date();                                                                                                                                                                       
//j=n.getSeconds();
m=n.getMilliseconds();
t=n.getSeconds();
b=m*.001;
j=t+b;

if      (j<20.3) document.write("<center><a href=\"http://www.yoursite.com\" target=\"_blank\"><img src=\"http://www.yoursite.com/ban.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");
else if (j<40.1) document.write("<center><a href=\"http://www.yoursite.com\" target=\"_blank\"><img src=\"http://www.yoursite.com/ban.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");
else if (j<59.9) document.write("<center><a href=\"http://www.yoursite.com\" target=\"_blank\"><img src=\"http://www.yoursite.com/ban.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");

else          document.write("<center><a href=\"http://www.defaultlink.com\" target=\"_blank\"><img src=\"http://yoursite.com/big.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");
//----Banner Rotation-----End Hide from inferior browsers----->


propromotions 06-16-2005 09:40 AM

Quote:

Originally Posted by SmokeyTheBear
heres a simple text or image banner rotation
Code:

<!----Main Banner Rotation--------

var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) hahahaha 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }

var winl = (myWidth - 624) / 2;
var wint = (myHeight - 600) / 2;

n=new Date();                                                                                                                                                                       
//j=n.getSeconds();
m=n.getMilliseconds();
t=n.getSeconds();
b=m*.001;
j=t+b;

if      (j<20.3) document.write("<center><a href=\"http://www.yoursite.com\" target=\"_blank\"><img src=\"http://www.yoursite.com/ban.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");
else if (j<40.1) document.write("<center><a href=\"http://www.yoursite.com\" target=\"_blank\"><img src=\"http://www.yoursite.com/ban.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");
else if (j<59.9) document.write("<center><a href=\"http://www.yoursite.com\" target=\"_blank\"><img src=\"http://www.yoursite.com/ban.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");

else          document.write("<center><a href=\"http://www.defaultlink.com\" target=\"_blank\"><img src=\"http://yoursite.com/big.gif\" alt=\"your alt text\" height=80 width=624 border=0></a>\n");
//----Banner Rotation-----End Hide from inferior browsers----->


Thanks a bunch for your help!

SmokeyTheBear 06-16-2005 09:40 AM

the only part gfy screws up is one hahahaha..

just look in the code i posted above and find the hahahah it should be 2 equal signs next to each other like = = but right next to each other

SmokeyTheBear 06-16-2005 09:41 AM

wait im not finished , copy all that code into a text document and save it as banner.js

then to use it all you have to do is call the js file like this

<script language="javascript" src="http://yoursite.com/banners.js"></script>

SmokeyTheBear 06-16-2005 09:45 AM

ok now to explain th script a bit it basically works like a timer.. on a 60 second clock..

It uses document write to make the banners ( you can use just text links or images or flash or whatever you want really. )

In the example it only rotates between 3 links , but if you wanted to add more you simply make another line and edit the seconds.

Basically it gets the seconds of your time and if TIME is under 20 seconds it displays the first banner , if the time is over 20 but under 40 it displays the second banner , etc etc etc. So if you want to add another banner you need to edit the times of the other banners to.. You could also use this to run one banner 60% more than another by simply editing the gap of time it will be displayed on.. if your totally not understanding what i'm saying then.. drop your icq i'll explain it a bit better

viki 06-16-2005 09:48 AM

Here's a PHP solution that I use:

Put this in a separate file, add as many links as you'd like... and of course remember to escape all quotation marks within the link with a \.

PHP Code:

<? 
$bannerCounter= 1; 

$bannerCode[$bannerCounter] = "<a href=\"http://www.yoursite.com\">text link or image here</a>"; 
$bannerCounter++;

$bannerCode[$bannerCounter] = "<a href=\"http://www.yoursite.com\">text link or image here</a>"; 
$bannerCounter++;

$bannerCode[$bannerCounter] = "<a href=\"http://www.yoursite.com\">text link or image here</a>"; 
$bannerCounter++;



$bannerAdTotals = $bannerCounter - 1; 
if($bannerAdTotals>1) 
{
   mt_srand((double)microtime() * 1234567); 
   $bannerPicked = mt_rand(1, $bannerAdTotals); 
}
else
{
   $bannerPicked = 1; 
}
$bannerAd = $bannerCode[$bannerPicked]; 
?>


And then put this code where you want to see the rotation. Where it says "links.php" , rename that to whatever you named the previous file.

PHP Code:

<? 
include_once("links.php"); 
echo "<div align='center'>$bannerAd</div>";
?>


viki 06-16-2005 09:50 AM

Where it says "hahaha91" it should be a left bracket.

BillyHoe 06-16-2005 09:51 AM

Quote:

Originally Posted by propromotions
Thanks a bunch for your help!

thanks :)

Dusen 06-16-2005 09:56 AM

As an alternative to Smokey's Time based one (Which is a hot idea btw) I would suggest reading/writing out via PHP to a file an integer with what was last shown

so set up an array 0,1,2,3 with the addresses to rotate

echo "0" > file.txt

the script:
---------

read number from file,

if ($readnum!=count($array)-1) { $current=$readnumber+1; }
else { $current=0; }

echo $array[$current]
write $current to file

However this breaks down under heavy traffic performance wise but ensures even distribution. I didn't include all code cause I'm eating lunch.


All times are GMT -7. The time now is 12:44 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123