I want to call a script page in php where the referral link is visible when you mouse over the image, something like this:

http //mysite com/phpscript?d=www.site.com/thread/217.html

(I don't know php incredibly well yet - so if that doesn't look right please let me know)

And then based on whatever the script does 80% of the time it goes to the referral link, and the other 20% of the time it goes to a different predefined link.

Kind of like a TGP script link randomizer but slightly different.

I'm not even sure this is the right language for this..

Newbie poster

http //mysite com/phpscript.php?d=www.site.com/thread/217.html

Ok, but I'm only tricking them 20% of the time which is a hell of alot less of the time than usual TGP scripts

If you don't know what a TGP script is google it, or Google onlyteenstgp (18+),

And yes it can be done in PHP and this is the PHP/Webdevelopement area on Daniweb so .. you sir are an as

commented: keep it pleasant +0

Im not sure why you want to redirect away from your site 80% of the time, as that would pretty much ensure 80% of the people would not want to visit your site because it's useless.

However, if you wish to pursue this you have 2 options.

1 - pure PHP (with a database of links), and, just as you said, do random(100) and if it's > 80, then echo "href='mylink'" as drawn from database A, and if < 80, then href='fakelink' as drawn from database B.

2 - Use javascript and at runtime, change it in the same fashion as above.

While I am trying to keep a personal tone out of this, I need to say that pushing 80% of your traffic away is stupid and counter productive... but I'm sure you have your reasons (of which, I have no desire to learn).

EDIT: I did not go to the site you linked. Im assuming if you want people to "believe" they are going to one link, but are redirected to another, you need to use javascript and onclick()

80% of the time they are referred to a link ON my site, 20% of the time they are sent to an advertiser blind click link that pays $4/1000 clicks.

The advertiser link is one link all the time.

I already wrote a Javascript version of this. (See below).

The problem with the Javascript is they can just mouse over the link and see it's not on my site.

<script type='text/javascript'>
var links=new Array();
links[0]='http://cluster.adultadsitexxxexample.com/redir/default.aspx?s=90909&c=3456'; //Adult redirect that pas $4/1000
links[1]='http://mysite.com/b/res/216.html';
var linkorig=new Array();

linkorig[1]='http://mysite.com/b/res/216.html';
linkorig[2]='http://mysite.com/b/res/217.html#218';
linkorig[3]='http://mysite.com/p/res/175.html';
linkorig[4]='http://mysite.com/links/res/171.html';
linkorig[5]='http://mysite.com/p/res/174.html';
linkorig[6]='http://mysite.com/p/res/70.html';
linkorig[7]='http://mysite.com/p/res/104.html';
linkorig[8]='http://mysite.com/sw/res/2.html';
linkorig[9]='http://mysite.com/t/res/306.html';
linkorig[10]='http://mysite.com/t/res/299.html';
linkorig[11]='http://mysite.com/t/res/209.html';
linkorig[12]='http://mysite.com/t/res/113.html';

var thumbd=new Array();
thumbd[1]='01';
thumbd[2]='02';
thumbd[3]='03';
thumbd[4]='04';
thumbd[5]='05';
thumbd[6]='06';
thumbd[7]='07';
thumbd[8]='08';
thumbd[9]='09';
thumbd[10]='10';
thumbd[11]='11';
thumbd[12]='12';

    for (i=1;i<=12;i++) {
        links[1]=linkorig[i];
            var k = Math.floor(Math.random()*links.length);
            document.write('<td><a href="'+links[k]+'"><img src="http://mysite.com/thumbs/thumb'+thumbd[i]+'.jpg" alt="" class="img" border="1" height="200" width="150"><br></a></td>');
                if(i == 6 || i == 12){
                document.write('</tr></tbody></table>');
                document.write('<table border="0" cellpadding="2" cellspacing="0" width="100%"><tbody><tr align="center" valign="bottom">');
                }

    }



</script>

That^ is the Javascript, but obviously it produces the link before the page is shown, I want a script that decides what the link will be AFTER they click it. I don't care what language it's done in as long as it's DECIDED AFTER they click it.

PHP is obviously the correct language..

IT CANT USE A DATABSE NO DATABASES ALLOWED IN THIS ONE YOU CAN EASILY DO IT WITHOUT A DATABASE.

What the hell is the point of using a database I WANT THE LINKS TO BE SEEN LIKE IN A TGP SCRIPT SO THEY WILL CLICK IT YOU DUMB DONKEY.

commented: keep it pleasant -2

SEE these links? from the js?

linkorig[1]='http://mysite.com/b/res/216.html';
linkorig[2]='http://mysite.com/b/res/217.html#218';
linkorig[3]='http://mysite.com/p/res/175.html';
linkorig[4]='http://mysite.com/links/res/171.html';
linkorig[5]='http://mysite.com/p/res/174.html';
linkorig[6]='http://mysite.com/p/res/70.html';
linkorig[7]='http://mysite.com/p/res/104.html';
linkorig[8]='http://mysite.com/sw/res/2.html';
linkorig[9]='http://mysite.com/t/res/306.html';
linkorig[10]='http://mysite.com/t/res/299.html';
linkorig[11]='http://mysite.com/t/res/209.html';
linkorig[12]='http://mysite.com/t/res/113.html';

they will be called with the php function they will be sent to the php script and function either embedded into the index.php or called in a page

CAN YOU NOT READ??

commented: you really know how to get people to want to help you, not... +0

Im not sure why you want to redirect away from your site 80% of the time, as that would pretty much ensure 80% of the people would not want to visit your site because it's useless.

10 Billion people a minute visit my site cause it has porn on it, I need to use every way I can to make money off that traffic.

so by your calling me a "dumb monkey" you went from having someone willing to help, to another person who will just ignore you.

You are what makes the internet rot. I for one will be happy to see you fail.

commented: well said +11

Buddy, I don't need your help. You do not have an expertise in anything.

It's better you not contribute your boneheaded know nothing statements on this site anyway..

commented: ENOIGH! +0

You keep trying to re form what I am ACTUALLY trying to do and telling me I need a database and other stuff I don't need.

I have a very clear idea of what I am trying to do, I have 90% of my life in years programming experience I only need to Google about 3 things before I have this script made.

I was hoping someone here would be able to send me in the right direction by telling me how to call a local phpscript.php?variables, and a couple things..

Yeah you make me mad cause you don't know shirt from shinola,

You just assume assume assume and assume.

And yeah why do you get to call my site 'useless' you don't know anything about the internet.

<?php

$boardid = $_GET['boardid'];
$postid = $_GET['postid'];

$link1 = "http://mysite.com/";
$link1 .= $boardid;
$link1 .= "/res/";
$link1 .= $postid;
$link1 .= ".html";

$link2 = "http://paidlink/redir.php?999999";

if (rand(1,100) >20){
header( "Location: $link1" ) ;
}
else{
header( "Location: $link2" ) ;
}
?>

I did it in less than 20 minutes you piece of garbage.

You better go cry internet tough guy. I didn't fail like you said I would.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.