Need some php help here.

Discussion in 'PHP' started by ashish1987, May 17, 2008.

  1. #1
    Hello
    I run a website http://tinyurl.com/5ws37t
    Now, I put up links to the movies here and there and the problem that I am facing is that some sites put up my links and the links open like this :

    http://tv-links.eu/show_link.php?link=http://moviefreek.org/watch/forgetting-sarah-marshall/online/
    
    http://tv-links.cc/redir4.php?l=aHR0cDovL3d3dy5tb3ZpZWZyZWVrLm9yZy93YXRjaC9pcm9uLW1hbi9vbmxpbmUv
    
    Code (markup):
    i.e the link opens in a frame
    When the link opens in a frame, adbrite's full page ads do not display and thus, I loose money. I want someone make a little code so that either, the upper frame is removed itself or that it redirects to my main website or gives a message that this can not be viewed in a frame. Is this possible ?
     
    ashish1987, May 17, 2008 IP
  2. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do it by the help of javascript. Force the page to open in parent frame.
     
    allaboutgeo, May 17, 2008 IP
  3. ashish1987

    ashish1987 Well-Known Member

    Messages:
    824
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Can you tell me what will be the code for this?
     
    ashish1987, May 17, 2008 IP
  4. geforce

    geforce Active Member

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #4
    This may help you:

    
    
    <script>
    if(top.location != self.location) {
    
       top.location.replace(self.location);
    
    }
    </script>
    
    
    Code (markup):
    That code will check if the page is in a frame, if it is, it will change the main window to what the frame is.
     
    geforce, May 17, 2008 IP
    ashish1987 likes this.
  5. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <script>
    if (parent.frames.length > 0) {
        parent.location.href = self.document.location
    }
    </script>
    Code (markup):
     
    allaboutgeo, May 18, 2008 IP
    ashish1987 likes this.
  6. ashish1987

    ashish1987 Well-Known Member

    Messages:
    824
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    110
    #6
    Codes work. Thank you guys. Repped you :)
     
    ashish1987, May 18, 2008 IP