Does this PHP actually do what I think it does?

by Thomas
4 replies
Hello Warriors:

Another Warrior very helpfully gave me the PHP code below when I asked in the Main Forum (admittedly the wrong forum to ask though) about showing different buttons to different site visitors, depening on whether they arrived at the site via Clickbank affiliate link, or by some other means.

Here it is:
<?php

function getbuynow(){
if(isset($_GET['clickbankidref')){
include('button1.html');
}else{
include('button2.html');
}
}
?>

Then, your 'clickbankidref' above is the part in bold below:
http://somedomain.com?clickbankidref=132142
However, as my current PHP abilities haven't gone far beyond monkey-see-monkey-do, I'm a bit confused about how to implement it.

For example, should button1.html and button2.html actually be button1.jpg and button2.jpg? I assumed they would be but, if not, does the php code insert the html code of those files into the html of the main page, meaning you can use the code to insert alternate text, as well as graphics? And, if so, will that newly inserted html take heed of any css being applied to the main page?

Also, how does the 'clickbankidref' work for the newer type Clickbank affiliate links, which look like this:

Code:
http://af2578ro8rbgh65bw0l.hop.clickbank.net/?tid=123ABC
When clicked on, links like that resolve to something like:

Code:
http://www.mydomain.com/?hop=123456
...where 123456 is the affiliate CB nickname.

Is 'clickbankidref', therefore, simply the word "hop"? (It can't be that simple... can it? )

Regards,
Tommy.
#php
  • Profile picture of the author aarondwyer
    You are on the right track, why don't you try it and see how you go.

    Use 'hop' as the parameter to check

    Aaron
    Signature
    http://backup-smart.com - Automatically And Safely Backup All Your cPanel Websites To Your Local Computer, Get your Free 7 Day Trial. Windows, MAC
    {{ DiscussionBoard.errors[1922337].message }}
    • Profile picture of the author Thomas
      Originally Posted by aarondwyer View Post

      ...why don't you try it and see how you go.
      Quite right! I just answered most of my own questions by doing so, however, the code itself doesn't seem to do what it is supposed to do.

      It appears to be displaying the content of button1.html (or clickbank.html, as I called it) for everybody.
      {{ DiscussionBoard.errors[1929428].message }}
  • Profile picture of the author FloridaRay
    It looks right to me. You might want to recheck the parameters if it isn't doing what you want it to.
    Signature
    From whatever walk of expertise you come from, you will benefit from this outstanding virtual book. Making money never got simpler.
    [Click here for WSO]
    {{ DiscussionBoard.errors[1929537].message }}
  • Profile picture of the author Thomas
    Dear God, I'm so stupid. :rolleyes:

    As always, the problem was simple: I didn't SAVE (duh!) the changes to index.html after adding the PHP, so it just uploaded exactly as before and, since clickbank.html contains the same html that was originally on the page, it looked like clickbank.html was showing up for everybody.

    Anyway, thanks Arron and Ray.
    {{ DiscussionBoard.errors[1929707].message }}

Trending Topics