<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
$llym = $_SERVER["HTTP_REFERER"];//记住来路的域名
include("sql/conn.php"); 

$result = mysql_query("SELECT * FROM user where name ='".$_SESSION['name']."'");
while($row = mysql_fetch_array($result))
  {
  $_SESSION['jf'] = $row['jf'];
  }////////重新查看积分值//////////  

	  if (empty($_SESSION['name']))
	  {
	    header("Location: index.php");
       	include("sql/close.php");
      }
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

</head>

<?php
session_start(); //开着身份验证，以后写
$llym = $_SERVER["HTTP_REFERER"];//记住来路的域名
include("han.php");///加入符号与数字转换的函数

$name = strip_tags ($_POST['name']); 
$ip = strip_tags ($_POST['ip']); 

$_POST['y'] = sprintf("%04d", $_POST['y']); 
$_POST['m'] = sprintf("%02d", $_POST['m']); 
$_POST['d'] = sprintf("%02d", $_POST['d']); 
$_POST['h'] = sprintf("%02d", $_POST['h']); 
$_POST['i'] = sprintf("%02d", $_POST['i']); 

$time = $_POST['y'].$_POST['m'].$_POST['d'].$_POST['h'].$_POST['i']."00"; ///////收集时间结构
$time = strtotime($time) ;///////时间转为时间戳

$len = strip_tags ($_POST['len']); 
$js = strip_tags ($_POST['js']); 

$js = str_replace("QQ","",$js);
$js = str_replace("QQ群","",$js);

$kf = strip_tags ($_POST['kf'],"<a>"); 
$kf = str_replace("<a","<a target=_blank ",$kf);
$kf = str_replace("<A","<a target=_blank ",$kf);
$kf = str_replace("私服","",$kf);
$name = str_replace("私服","",$name);
$len = str_replace("私服","",$len);

$kf = str_replace("TTPK","",$kf);
$name = str_replace("TTPK","",$name);
$len = str_replace("TTPK","",$len);


$url = strip_tags ($_POST['url']); 

////////////////////////////////////////////////////////////////////////判断域名是否被过滤
	 $urlymz =  parse_url($res[0]);///提取域名
	 $urlym = $urlymz[host];///提取域名
	 $kfkf = $kf;////////提取厂商客服
	 $result = mysql_query("SELECT * FROM glurl where url ='".$urlym."' or bz ='".$kfkf."' ");
	 if (mysql_num_rows($result) != 0)
	 {//////////域名过滤或厂商名过滤之后，不给发布
	 $_GET['k'] = "域名过滤！";
	 }
	 else
	 {//////////没有域名或厂商名过滤过滤，这是可以发布的
	 }
//////////////////////////////////////////////////////////////////////判断域名是否被过滤


$name = f_z($name);
$ip = f_z($ip);
$len = f_z($len);
$js = f_z($js);
///////$kf = f_z($kf);
$kff = $_SESSION['fk'] * $_POST['long1'];//////所扣分数，为了和客服变量出变化

if ($_SESSION['jf']<$kff)
  {
  /////////////echo "本次操作积分不足";
  $_GET['k'] = "";
  }

$url = f_z($url);

$ff = strip_tags ($_POST['ff']); 

$long1 = $_POST['long1'] * "3600" ; 
$noww = time();
$idid = $_SESSION['name']."|".$noww;
$iipp = $_SERVER["REMOTE_ADDR"];

$result=mysql_query("INSERT INTO ".$_GET['k']." (name,ip,time, len, js,kf,url,bz,ks,long1,idid,zt)
 VALUES ( '".$name."','".$ip."','".$time."','".$len."','".$js."','".$kf."','".$url."','".$_SESSION['name']."','".$time."','".$long1."','".$idid."','9')");

echo $result;

if($result) 
{
////////////    echo   '成功 '; 
///////echo $kff;
$_SESSION['jf'] = $_SESSION['jf'] - $kff;

///////////////////////////////////////////////////////////////////////////////
if($_POST['key1']!="")///////如果奖励码不为空，那么就入库
{

$key1 = $_POST['key1'];
$key1 = str_replace("\r\n","www.ttpk.net",$key1);
$key10 = explode('www.ttpk.net',$key1);
$i=0;
while($key10[$i]!="")////////只要还有，就录入。
  {
mysql_query("INSERT INTO key1 (name, kf, len, number, life, time1, true1, ip, user,url,ff,idid)
VALUES ('".$name."', '".$kf."', '".$len."', '".$key10[$i]."', '345600', '".$noww."', '1', '".$iipp."', '".$_SESSION['name']."','$url','".$ff."','$idid')");
  $i++;
  }

}
///////////////////////////////////////////////////////////////////////////////

mysql_query("UPDATE user SET jf = '".$_SESSION['jf']."' WHERE name = '".$_SESSION['name']."'");
mysql_query("INSERT INTO text (name, time, ip, ing, f) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '成功发布[".$name."]', '-".$kff."')");
}
else 
{
/////    echo   '失败 ';
mysql_query("INSERT INTO text (name, time, ip, ing, f) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '发布失败[".$name."][".$_GET['k']."]', '0')");
}
?>

<?php include("sql/close.php");?>


<script language="javascript">setTimeout(function (){location.href='rz.php';},2);</script>
