<?php

include('../common.php');
include('../sql.php');

$arr = array(
		'message' => 'fail',
		'reason' => '暂时不支持手机端评论'
	);
	$ret = json_encode($arr);
	echo $ret;
	exit();


$versioncode = $_GET['versioncode'];
$count = empty($_GET['count']) ? 20:$_GET['count'];
$imei = $_GET['imei'];
$device_type = $_GET['device_type'];
$os_version = $_GET['os_version'];

$arcid = $_REQUEST['arcid'];

$msg = $_REQUEST['msg'];
$msg = urldecode($msg);

function get_real_ip()
{
$ip=false;
if(!empty($_SERVER["HTTP_CLIENT_IP"])){
  $ip = $_SERVER["HTTP_CLIENT_IP"];
}
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
  $ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
  if($ip){
   array_unshift($ips, $ip); $ip = FALSE;
  }
  for($i = 0; $i < count($ips); $i++){
   if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i])){
    $ip = $ips[$i];
    break;
   }
  }
}
return($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}
$ip = get_real_ip();
$time = time();

if ($arcid=="" || $msg==""   ){
	$arr = array(
		'message' => 'fail',
		'reason' => '信息不全'
	);
	$ret = json_encode($arr);
	echo $ret;
	exit();
}





// $query = "insert into ".tname("cm")." (cm_cid,  cm_ip, cm_addtime,cm_content) values ($arcid,'$ip',$time,'$msg')";
$query = add_feed_back($arcid, $ip, $time, $msg);
$listquery = $_TD->FM($query);

$arr = array(
		'message' => 'success',
		'reason' => 'OK'
	);
$ret = json_encode($arr);
echo $ret;


?>