URL masking for URL shortening script?

Discussion in 'Programming' started by DaFiz, Jan 11, 2010.

  1. #1
    Hi guys,

    I have a URL shortening script that I use on a couple of my domains. It generates a URL like domain.com/recommends/SEO which when clicked on goes to eg. seo.com/?affid=dafiz

    What I would like is for the URL to still be domain.com/recommends/SEO

    Am I right in saying that this can only be done using an iframe?

    Anyone know how to generate the iframe code dynamically?

    I imagine the static code would like something like this:-

    
    <html>
    <head>
    <title>Website</title>
    <style>
    html, body, iframe
    {
    margin: 0px;
    padding: 0px;
    border: 0;
    text-align: center;
    overflow-x: hidden;
    overflow-y: auto;
    }
    </style>
    </head>
    <body>
    <IFRAME SRC="http://www.site.com" scrolling="yes" width="100%" height="100%" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0" >
    </body>
    </html>
    
    Code (markup):
     
    DaFiz, Jan 11, 2010 IP
  2. ayushdeepsingh

    ayushdeepsingh Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    yah using javascript u can generate iframe dnammicly !!
     
    ayushdeepsingh, Jan 12, 2010 IP
  3. goliath

    goliath Active Member

    Messages:
    308
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #3
    I think actual frames are still available for this purpose, as well.
     
    goliath, Jan 12, 2010 IP
  4. DaFiz

    DaFiz Active Member

    Messages:
    38
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    The current bit of code that does the redirect is

    header("Location:".$array['target']);
    Code (markup):
    What code would I need to replace this with to be able to accomplish the result I am after?
     
    DaFiz, Jan 13, 2010 IP
  5. goliath

    goliath Active Member

    Messages:
    308
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #5
    
    
    <frameset>
    	<frame src="http://photostouse.com/">
    	</frame>
    </frameset>
    
    
    Code (markup):
     
    goliath, Jan 13, 2010 IP
  6. DaFiz

    DaFiz Active Member

    Messages:
    38
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Thanks heaps @goliath (I have left you some rep also)
    I now have some working code. I ended up with the following in place of the header:location code

    echo '<frameset>
    	<frame src="'.$array['target'].'">
    	</frame>
    </frameset>';
    Code (markup):
    And it seems to be working a treat :):)
     
    DaFiz, Jan 13, 2010 IP
  7. goliath

    goliath Active Member

    Messages:
    308
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Glad to help. It's always nice when you can go with a simple solution.
     
    goliath, Jan 13, 2010 IP