26 Replies Latest reply: Dec 7, 2010 3:03 AM by 123polis123 RSS

    cookies by cfm may retrieved by php

    123polis123 Community Member

      cookies by cfm may retrieved by php? if iframe have or not (other page)?

      In a cfm page may insert:

       

      <iframe src="country.php" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="0" height="0" style=" border:none"></iframe>

       

      where country.php:                 // to get ip I used $_COOKIE['countNumVisitor'] set by cfm, get by php,  well seems default NULL appear in country always, where error?

       

       

      <?php

      function getIP()
      {
      if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
      else if (isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
      else $ip = “UNKNOWN”;
      return $ip;
      }

      $ipNEW = getIP();
      $IP=$ipNEW;
      if ((!empty($IP)) && ($IP != "UNKNOWN")){
      $country = file_get_contents('http://api.hostip.info/country.php?ip='.$IP);
      } else
      $country = 'unknown';

          include("pass/passwords.php");

      $linkid = mysql_connect($hostname,$username,$password);
      @mysql_select_db($database,$linkid) or die( "Unable to select database");
      $countNumVisitor=$_COOKIE['countNumVisitor']);
      $query15 = "INSERT INTO yyyy SET country='$country' WHERE countNumVisitor = $countNumVisitor";    // refURL
      $result15 = @mysql_query($query15,$linkid) or die("Unable to execute query. Please try again later. line 168");  // linkid2


      mysql_close($linkid);
      ?>