Results 1 to 4 of 4

Thread: php frame problem

  1. #1
    Join Date
    Dec 2008
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question php frame problem

    Hi, im having a problem adding a frame busting killer that counteracts a frame killer script on sites so i can load them inside my iframes..

    here is the code i use

    <?php
    $result = mysql_query("SELECT ru.id, ru.username, ru.owid FROM raidbar_users ru LEFT JOIN raidbar_groups rg ON ru.groupid = rg.id WHERE rg.id = '".(int)$_REQUEST['group']."'") or die(mysql_error());
    $myRaidid = raidid();

    if(isset($_GET['gm']))
    {
    echo '<FRAMESET rows="*,*,*,30" frameborder="0">' . "\n";
    echo ' <FRAMESET cols="*,*" frameborder="0" scrolling="no">' . "\n";
    $i = 0;
    while($row = mysql_fetch_array($result))
    {
    if ($i == 2)
    {
    echo ' </FRAMESET>' . "\n";
    echo ' <FRAMESET cols="*,*" frameborder="0" scrolling="no">' . "\n";
    $i = 0;
    }
    echo ' <FRAME src="http://'.$server[$siteConfig['userServer']].'.outwar.com/joinraid.php?raidid=' . $myRaidid . '&suid=' . $row['owid'] . '&serverid='.$siteConfig['userServer'].'">' . "\n";
    $i++;
    }
    echo ' <FRAME src="">' . "\n";
    echo ' </FRAMESET>' . "\n";
    echo ' <FRAMESET frameborder="0" scrolling="no">' . "\n";
    echo ' <FRAME src="http://'.$server[$siteConfig['userServer']].'.outwar.com/raidmembers.php?raidid=' . $myRaidid . '">' . "\n";
    echo ' </FRAMESET>' . "\n";
    echo '</FRAMESET>' . "\n";
    }
    else
    {
    echo '<table cellspacing=1 cellpadding=1>' . "\n";
    echo '<tr>' . "\n";
    $i = 0;
    while($row = mysql_fetch_array($result))
    {
    if ($i == 2)
    {
    echo '</tr>' . "\n";
    echo '<tr>' . "\n";
    $i = 0;
    }
    echo ' <td><iframe src="./acct.php?suid=' . $row['owid'] . '" width=450 height=225 scrolling=no frameborder=0></iframe>' . "\n";
    $i++;
    }
    echo '</tr>' . "\n";
    echo '<tr>' . "\n";
    echo ' <td><iframe src=http://'.$server[$siteConfig['userServer']].'.outwar.com/raidmembers.php?raidid=' . raidid() . '&serverid='.$siteConfig['userServer'].' width=250 height=30 scrolling=no></iframe>' . "\n";
    echo '</tr>' . "\n";
    echo '</table>' . "\n";
    }
    ?>


    Now im told to use the following..
    <script type="text/javascript">
    var prevent_bust = 0
    window.onbeforeunload = function() { prevent_bust++ }
    setInterval(function() {
    if (prevent_bust > 0) {
    prevent_bust -= 2
    window.top.location = 'http://server-which-responds-with-204.com'
    }
    }, 1)
    </script>


    or
    var prevent_bust = 0;

    // Event handler to catch execution of the busting script.
    window.onbeforeunload = function() { prevent_bust++ };

    // Continuously monitor whether busting script has fired.
    setInterval(function() {
    if (prevent_bust > 0) { // Yes: it has fired.
    prevent_bust -= 2; // Avoid further action.
    // Get a 'No Content' status which keeps us on the same page.
    window.top.location = 'http://server-which-responds-with-204.com';
    }
    }, 1);


    But the window.top.location i dont know how to incorporate that to work.

    Can anyone help?
    Last edited by VsUK; 05-04-2011 at 12:05 PM.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    First, this is not a php problem, but javascript.
    Second, I would suggest that if a site doesn't want you to serve their content in an iframe, that you don't.

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    I agree with traq.

    Whether you mean to or not, framing another web page makes it look like its part of your site (depending on the surrounding web page), which can be perceived as misleading and deceptive.

    I think its more courteous to the other website owner to provide a description/pic with a link so visitors can follow if they choose.
    Last edited by Beverleyh; 05-05-2011 at 05:12 PM.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    As a more general note, you should think of PHP as generating HTML (and Javascript, CSS, etc.). This means that posting PHP code here is not relevant to the Javascript. You should view your page and choose view>source and post THAT code here. Then you will fix the Javascript and get the desired output. And only after all of that will you need to adjust your PHP to actually generate that. PHP is not a "flat" process that just makes your site "work" after you use it. You need to have output text in mind then find a way to make PHP generate that output.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •