iframe

Discussion in 'PHP' started by gigamike, Jun 5, 2008.

  1. #1
    Guys,

    I hope you can help me. I have a simple html page

    i.e. test.html which contains

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    <body>
    <iframe src="http://www.domain.com/log.php?ad=http://www.domain.com/pop.html&aid=73" width="300" height="600" scrolling="no"></iframe>
    </body>
    </html>

    Now the log.php only contains an Insert Statement

    include_once('configuration.php');

    $remote_ip=mysql_escape_string($_SERVER['REMOTE_ADDR']);
    $browser=mysql_escape_string($_SERVER['HTTP_USER_AGENT']);
    $referrer=mysql_escape_string($_SERVER['HTTP_REFERER']);
    $aid=mysql_escape_string($_GET['aid']);

    $db->query("INSERT INTO `pagerequest`(`ad_id`, `ip`, `timestamp`, `browser`, `referrer`)
    VALUES('$aid', '$remote_ip', now(), '$browser', '$referrer')");

    header("Location: ".$_GET['ad']);
    exit();

    The log works fine on first visit on test.html, BUT when i refresh 2 or N times, the log is only 1. Seems like the iframe SRC is cache.

    I try to setup a dynamic URL like

    src="http://www.domain.com/log.php?ad=http://www.domain.com/pop.html&aid=73&time=YYYYMMDDHHIISS"

    But still no luck :(

    Any idea.

    Thanks,

    Mike
     
    gigamike, Jun 5, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    So the iframe doesn't really send anything to the webpage? Might try setting the headers to include a no-cache pragma. And does the timestamp change after later visits?
     
    shallowink, Jun 5, 2008 IP