<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Pragma: no-cache");
if(!@eregi($_SERVER['SERVER_NAME'],$_SERVER['HTTP_REFERER'])){exit('QQ:848769359');}
include_once("../lib/cs_conn.php");
include_once("../lib/cs_common.php");

$ac=CS_Request('ac');
$id=CS_Request('id');
global $db;
	$row=$db->getRow("select * from ".Getdbname('dance')." where CS_ID=".$id." and cs_yid=0");
	if($row){
             $name=$row['CS_Name'];
             $neir="管理员您好，《".$row['CS_Name']."》不能视听，请修复下！";
        }else{
             exit("<script>alert('抱歉，该歌曲不存在!');this.parent.$('.webox').css({display:'none'});this.parent.$('.background').css({display:'none'});</script>");
        }
?>
<!doctype html>
<html>
<head>
<meta charset="gbk">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>csdjcms management</title>
<link href="css/cscms.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery.js"></script>
<style> 
body{width:440px;}
</style>
<script language="javascript"> 
function stop(){return false;} 
document.oncontextmenu=stop; 
function dhcolok(){
    this.parent.$('.webox').css({display:'none'});
    this.parent.$('.background').css({display:'none'});
}
$(document).ready(function(){
	$("#adderror").click(function(){
		var CS_Content=$("#CS_Content").val();
	$("#CS_Content").css("border-color","#666 #ccc #ccc #666");
	if(CS_Content==""){
		$("#CS_Content").css("border","1px solid red");
		$("#Msg").text("请填写报错内容！").css("color","red");
		return false;
		}
	});
});
</script>
</head>
<body class="body_none">
<div>
<!-- mod start -->
<form method="post" class="J_ajaxForm" action="?ac=add" data-role="edit">
<div class="pop_cont pop_table2">
	<table width="100%" style="table-layout:fixed;">
		<col width="90" />
		<col /><input name="id" type="hidden" value="<?php echo $id?>" />
		<tr>
			<th>歌曲名称</th>
			<td>
				<?php echo $name?>
			</td>
		</tr>
		<tr>
			<th>报错内容</th>
			<td>
				<span class="must_red">*</span>
				<div class="mb5"><textarea class="length_6" id="CS_Content" name="CS_Content"><?php echo $neir?></textarea></div>
			</td>
		</tr>
	</table>
</div>
<!-- mod end -->
<div class="pop_bottom">
    <div class="tips_error" id="Msg"></div>
	<button class="btn fr" onclick="dhcolok();" type="button">取消</button>
	<button class="btn btn_submit J_ajax_submit_btn mr10 fr" id="adderror" type="submit">提交</button>
</div>
</form>
<!-- end -->
<?php
if($ac=='add'){
	$CS_IP = ($_SERVER["HTTP_VIA"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"];
	$CS_IP = ($CS_IP) ? $CS_IP : $_SERVER["REMOTE_ADDR"]; 
        $CS_Content=filter(CS_Request('CS_Content'));
		if(DateDiff($_SESSION['errortime'],date("Y-m-d H:i:s"))<30){
			echo '<script>$("#Msg").text("麻烦您，休息下在提交!").css("color","red");</script>';
		}
                if(empty($CS_Content)){
			echo '<script>$("#Msg").text("报错内容为空!").css("color","red");</script>';
                }
		$sql="Insert ".Getdbname('error')." (CS_Ip,CS_Content,CS_DID,CS_Name,CS_AddTime) values ('".$CS_IP."','".$CS_Content."',".$id.",'".$name."','".date("Y-m-d H:i:s")."')";
		if($db->query($sql)){
			$_SESSION['errortime']=date("Y-m-d H:i:s"); 
                       echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜您,报错成功，请等待管理员修复!").css("color","#026E12");</script>';
                       echo "<script>setTimeout(\"dhcolok();\",3000);</script>";
		}else{
                       echo '<script>$("#Msg").text("抱歉,报错失败!").css("color","red");</script>';
                       echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
                }
}
function filter($str){
	$KeyArr=explode(',','http://,www,胡锦涛,温家宝,尻,屌,操你,干死你,贱人,狗娘,婊子,表子,靠你,叉你,叉死,插你,插死,干你,干死,日你,日死,鸡巴,睾丸,包皮,龟头,屄,赑,妣,肏,奶子,奶头,阴毛,阴道,阴茎,叫床,强奸,爱液,性高潮,做爱,性交,口交,肛交,3P');
	for($i=0;$i<count($KeyArr);$i++){
		$str=CS_ReplaceStr($str,$KeyArr[$i],"**");
	}
	return $str;
}
?>
</div>
</body>
</html>