<?php

function writeLog($msg)
{
    $logFile = date('Y-m-d').'.txt';
    $msg = date('Y-m-d H:i:s').' >>> '.$msg."\r\n";
    return file_put_contents($logFile,$msg,FILE_APPEND );
}

function access_url($url) {  
    if ($url=='') return false;  
    $fp = fopen($url, 'r') or exit('Open url faild!');  
    if($fp){
    while(!feof($fp)) {  
        $file.=fgets($fp)."";
    }
    fclose($fp);  
    }
    return $file;
}

if( isset($_GET['platform']) )
{ 
   $plat = $_GET['platform'];    
}
else
{
  print_r("没有输入广告平台!");
  exit;
}


if( isset($_GET['website']) )
{ 
  $web = $_GET['website'];  
  
  if($web!='null')
  {  
 
    $converURL='http://conversions.adengage.com/serve/conversion/43/'.$web.'/'; 

    if( isset($_GET['IsUSCAUK']) )
    {
      $converYN = $_GET['IsUSCAUK']; 

       writeLog($converYN); 

      if($converYN == 'Y')
      {  
         access_url($converURL);
      }
     

    }
    else
    {
       access_url($converURL);
    }
   }
}
else
{
  print_r("没有输入网站!");
  exit;
}


if( isset($_GET['ExeName']) )
{ 
  $exe = $_GET['ExeName'];    
}
else
{
  print_r("没有输入ExeName!");
  exit;
}


if( isset($_GET['Status']) )
{ 
  $status = $_GET['Status'];    
}
else
{
  print_r("没有输入Status!");
  exit;
}


//连接MySQL
$conn = @mysql_connect("localhost", "gili0512", "nIJ9qatVBLKS");

if($conn == FALSE)
{	
  print_r("连接失败!");
  exit;
}

//选择数据库
mysql_select_db("gili0512_livecheck");

//执行SQL
$msg = date('Y-m-d H:i:s');

mysql_query("INSERT INTO installinfotj(id,Platform,Website,Date,ExeName,Status) VALUES (0, '$plat','$web','$msg','$exe','$status')");


//关闭连接
mysql_close();


?> 
