Posts tagged: linkshare

Random Linkshare ads PHP Script

comments Comments Off
By syclonefx, November 1, 2009 9:48 AM

I’ve been using LinkShare for years and one thing I hate about them is their random ads generator. It doesn’t work to well. Sometimes you get blank ads, and sometimes the ads are distorted and sometimes you get an ad that should be displayed. So I came up with this little PHP script. There is no limit on how many ads you can put in the script.

<?

//set the urls

$urls = array(
“http://click.linksynergy.com/fs-bin/click?id=Oj2S/gUYGEM&offerid=13850.10000348&type=4&subid=0″,
“http://click.linksynergy.com/fs-bin/click?id=Oj2S/gUYGEM&offerid=13850.10000335&type=4&subid=0″,
“http://click.linksynergy.com/fs-bin/click?id=Oj2S/gUYGEM&offerid=146261.10005058&type=4&subid=0″
);

//set the img links

$img = array(
“http://www.gamestop.com/gs/aflbanners/125x125_eb_re5.jpg”,
“http://www.gamestop.com/gs/aflbanners/468x60_gs_dsi.jpg”,
“http://images.apple.com/itunesaffiliates/US/2009/10/01/Smallville_s9_300x300.jpg”
);

//set the alt text s
$alttext = array(
“GameStop.com – Resident Evil 5″,
“GameStop.com – Nintendo DSi”,
“Apple iTunes – Smallville”
);

//set the linkshare images
$lnkimg = array(
“http://ad.linksynergy.com/fs-bin/show?id=Oj2S/gUYGEM&bids=13850.10000348&type=4&subid=0″,
“http://ad.linksynergy.com/fs-bin/show?id=Oj2S/gUYGEM&bids=13850.10000335&type=4&subid=0″,
“http://ad.linksynergy.com/fs-bin/show?id=Oj2S/gUYGEM&bids=146261.10005058&type=4&subid=0″
);

srand(time());

//set the number in (rand()%3); for however many links there are

$random = (rand()%3);

echo (“<a href = \”$urls[$random]\”>
<img alt=\”$alttext[$random]\” src=\”$img[$random]\”></a>
<img border=\”0\” width=\”1\” height=\”1\” src=\”$lnkimg[$random]\”>”);

?>


Apple iTunes - Glee

Panorama Theme by Themocracy