Masking URL's Using PHP

Discussion in 'PHP' started by ghazz, Aug 15, 2008.

  1. #1
    Hello,

    I'm setting up some affiliate links on a website. Lets say the product I am selling is netflix. I want to do a few things.

    I want my affiliate link hidden, so I'd like the link in the status bar to say www.netflix.com when you hover over a link.

    When you look at the source of the page the links actually say <a href="www.netflix.com>, so you cant tell what the link is by looking at the code.

    When clicking the link, it opens in a new tab/window and the location bar says http://www.netflix.com

    Can anyone tell me how to accomplish this? I'm thinking its a combination of using frames and links stored in a database, but I'm not sure. Thanks for any help.
     
    ghazz, Aug 15, 2008 IP
  2. Panzer

    Panzer Active Member

    Messages:
    381
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Your going to want to do this with javascript, don't over complicate things.
     
    Panzer, Aug 15, 2008 IP
  3. XenFen

    XenFen Banned

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or maybe just create a user login so only allowed members can view the page.
     
    XenFen, Aug 15, 2008 IP
  4. wongjowo

    wongjowo Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    cookie stuffing works..
     
    wongjowo, Aug 15, 2008 IP
  5. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    pretty sure you can't change the url that is on the actual netfilx page..
     
    garrettheel, Aug 16, 2008 IP
  6. nice.wallpapers

    nice.wallpapers Active Member

    Messages:
    142
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Hi,

    Here is the code for that :
    === Javascript function =====
    <script>
    //configure status message to show
    var statusmsg=""

    function hidestatus(){
    window.status=statusmsg
    return true
    }
    </script>
    === End Javascript function ====

    Use of javascript function : <a href="http://www.smartknight.com" onMouseover="return hidestatus()">Working</a>

    Thanks :)
     
    nice.wallpapers, Aug 17, 2008 IP
  7. ghazz

    ghazz Peon

    Messages:
    719
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    But with JavaScript, they are going to be able to look at the source of the page and see the real links, right?

    I have a competitor, that when you look at his site, it looks like hes reviewing a product and that the link goes right to the manufactorers page, but, its an affiliate site, hes paying for PPC and it at top spots. So hes making it somehow, and I'd assume its PHP. Anymore ideas?
     
    ghazz, Aug 17, 2008 IP
  8. guzz

    guzz Guest

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you may use seperate php file for redirecting

    redirect.php
    
    <?php
    $link = base64_decode($_REQUEST["link"]);
    header("location:".$link);
    ?>
    
    PHP:
    for your links
    
    <a href="redirect.php?link=<?=base64_encode('http://www.netflix.com');?>">
    
    PHP:
     
    guzz, Aug 17, 2008 IP
  9. mallorcahp

    mallorcahp Peon

    Messages:
    141
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You can no longer change status bar messages with JavaScript in IE7 with default settings ... best to use redirect as above

    from wikipedia:
     
    mallorcahp, Aug 18, 2008 IP
  10. ghazz

    ghazz Peon

    Messages:
    719
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I don't want to use PHP redirects. I want an link to be inextinguishable from a normal link. If you look at http://www.consumerpricewatch.net/ and look at his top diet pills, all of them appear to link to the manufacturer, but they are all affiliate links. So I know it can be done, and I'm hoping someone reading this will know too and share.
     
    ghazz, Aug 18, 2008 IP
  11. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #11
    You already have the clues to what is going on here. There is no mystical scripting going on in the background.

    One statement stands out "it looks like he's reviewing a product". And yes, the link goes right to the manufacturer's page. And why?

    It is a paid review, and the receiving site is tracking referrals from the linking page. The programming is on the other end, in other words. It is possible that tracking is monitored by a third-party also. Either way, it all looks normal in the actual content of the page.

    If you want to PM me with the particulars, I will check into it further for you.
     
    Dodger, Aug 18, 2008 IP
  12. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #12
    i would creat a database with these links in and pull the by a post/get call into another php file called redir or summat that way in your header a can chage location in the redir and the user only ever sees .php?id=3 etc

    this is the long way but the easist for me....
     
    cornetofreak, Aug 18, 2008 IP