<?
@header('Content-Type:text/html;charset=utf-8');
if(!$_POST['my_name']||!$_POST['my_hacked_url'])
{
	echo "<script>location.href='./index.php'</script>";
	exit;
}
@include('config.inc.php');
$tj_name=substr($_POST['my_name'],0,21);
$tj_team='';
$tj_names=explode('@',$_POST['my_name'],2);
if($tj_names[1]){
	$tj_name=substr($tj_names[0],0,21);
	$tj_team=substr($tj_names[1],0,21);
}
$tj_contact=substr($_POST['my_contact'],0,20);
$tj_hacked_url=substr($_POST['my_hacked_url'],0,70);
$tj_ip=$_SERVER["REMOTE_ADDR"];
$get_domain = parse_url($tj_hacked_url);
$tj_domain = $get_domain['host'];
if(!$tj_domain){echo $tj_hacked_url." <font color=\"#ff0000\">黑页地址错误!!!</font>";exit;}
if(!get_magic_quotes_gpc())
{
	$tj_name=addslashes($tj_name);
	$tj_team=addslashes($tj_team);
	$tj_contact=addslashes($tj_contact);
	$tj_domain=addslashes($tj_domain);
	$tj_hacked_url=addslashes($tj_hacked_url);
}

if($tj_domain==''){echo $tj_hacked_url." <font color=\"#ff0000\">黑页地址错误!!!</font>";exit;}
@$query=mysql_query("select tj_domain from `hacked_pages` where tj_domain='$tj_domain'");
@$row=mysql_fetch_array($query);
if($row['tj_domain']!=''){echo $tj_hacked_url." <font color=\"#ff0000\">该黑页地址已被提交过!!!</font>";exit;}
@$html=file_get_contents($tj_hacked_url);
if($html==''){echo $tj_hacked_url." <font color=\"#ff0000\">该黑页不存在或无法访问!!!</font>";exit;}
$tj_server='未知系统/其他系统';
$tj_reason='不想透露/其他原因';
$tj_hacked_type='不想透露/其他漏洞';

//获取google PR
@include('inc/get_pr.class.php');
$website ='http://'.$tj_domain.'/';
$tj_pr=pagerank($website);
if(!is_numeric($tj_pr)||$tj_pr>9){$tj_pr=0;}

$tj_date=time();
$sql="insert into hacked_pages(id,tj_name,tj_team,tj_contact,tj_server,tj_reason,tj_hacked_type,tj_hacked_url,tj_ip,tj_domain,tj_pr,tj_date,pending) 
values(NULL,'$tj_name','$tj_team','$tj_contact','$tj_server','$tj_reason','$tj_hacked_type','$tj_hacked_url','$tj_ip','$tj_domain','$tj_pr','$tj_date','0')";
@mysql_query($sql);//插入黑页

//生成快照
@$query=mysql_query("select last_insert_id()");//获取最后插入黑页id
@$row=mysql_fetch_array($query);
$id='./hacked_pages/'.md5(md5($row[0]).'tueur').'.html';
if(!file_exists($id))
{
	@$f=fopen($id,'w');
	@fwrite($f,$html);
	fclose($f);
}
$tj_name=htmlspecialchars($_POST['my_name']);
setcookie('my_name',$tj_name, time()+15*24*60*60);
setcookie('my_contact',$tj_contact, time()+15*24*60*60);
echo $tj_hacked_url." <font color=\"#33CC33\">提交成功并已生成快照!!!</font>";
?>