<?php

/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
function showmessage($CD_Msg, $CD_Url, $CD_Type) {
	if($CD_Type==1) {
		echo "<script language=javascript>alert('" . $CD_Msg . "');history.back(1);</script>";
	} elseif($CD_Type==2) {
		echo "<meta charset=\"gbk\" /> <center><script>";
		echo "document.write('<br><div style=\"width:500px;padding-top:6px;padding-bottom:3px;height:24;font-size:10pt;text-align:left;border-left:1px solid #5CB0DF;border-top:1px solid #5CB0DF;border-right:1px solid #5CB0DF;background-color:#5CB0DF;\">&nbsp;&nbsp;操作提示信息：</div>');";
		echo "document.write('<div style=\"width:500px;height:150;font-size:10pt;border:1px solid #5CB0DF;background-color:#F6F6F6;\"><br><br>');";
		echo "document.write('" . $CD_Msg . "');";
		echo "document.write('</div>');";
		echo "</script>";
		echo "</center>";
	} else {
		echo "<meta charset=\"gbk\" /> <center><script>var pgo=0;function CD_Url(){if(pgo==0){ location='" . $CD_Url . "'; pgo=1; }}";
		echo "document.write('<br><div style=\"width:500px;padding-top:6px;padding-bottom:3px;height:24;font-size:10pt;text-align:left;border-left:1px solid #5CB0DF;border-top:1px solid #5CB0DF;border-right:1px solid #5CB0DF;background-color:#5CB0DF;\">&nbsp;&nbsp;操作提示信息：</div>');";
		echo "document.write('<div style=\"width:500px;height:150;font-size:10pt;border:1px solid #5CB0DF;background-color:#F6F6F6;\"><br><br>');";
		echo "document.write('" . $CD_Msg . "');";
		echo "document.write('<br><br><a href=" . $CD_Url . ">如果你的浏览器没反应，请点击这里...</a><br><br><br></div>');";
		echo "setTimeout('CD_Url()',3000);</script>";
		echo "</center>";
	}
	exit();
}
function admincheck($value) {
	if(empty($_COOKIE['CD_AdminID']) || empty($_COOKIE['CD_Login']) || $_COOKIE['CD_Login']!==md5($_COOKIE['CD_AdminID'] . $_COOKIE['CD_AdminUserName'] . $_COOKIE['CD_AdminPassWord'] . $_COOKIE['CD_Permission'])) {
		showmessage("出错了，登录已过期，请重新登录！", "admin_login.php", 0);
	}
	if(!empty($_COOKIE['CD_Permission'])) {
		$array=explode(",", $_COOKIE['CD_Permission']);
		$adminlogined=false;
		for($i=0; $i<count($array); $i++) {
			if($array[$i]==$value) {
				$adminlogined=true;
			}
		}
		if(!$adminlogined) {
			showmessage("出错了，您没有进入本页面的权限！", "", 2);
		}
	} else {
		showmessage("出错了，您没有进入本页面的权限！", "", 2);
	}
}
function Smallfivesolution(){
	$types='6K+35L2/55So5q2j54mI5o6I5p2D6L2v5Lu277yM5o6I5p2D6K+36IGU57O7UVHvvJoxNTQyMzY3Nzky';
	$tex=cd_x5code;
	if (strpos($tex, ".")===false){ $reslutstr=iconv("UTF-8", "gb2312", base64_decode($types));}
	$type="Smallfive";
	$key=$_SERVER['SERVER_NAME'];
    $chrArr=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
                  'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
                  '0','1','2','3','4','5','6','7','8','9');
    if($type=="Smallfive"){
        if(strlen($tex)<14)return false;
        $verity_str=substr($tex, 0,8);
        $tex=substr($tex, 8);
        if($verity_str!=substr(md5($tex),0,8)){
            return false;
        }    
    }
    $key_b=$type?substr($tex,0,6):$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62];
    $rand_key=$key_b.$key;
    $rand_key=md5($rand_key);
    $tex=$type?base64_decode(substr($tex, 6)):$tex;
    $texlen=strlen($tex);
    $reslutstr="";
    for($i=0;$i<$texlen;$i++){
        $reslutstr.=$tex{$i}^$rand_key{$i%32};
    }
	if ($reslutstr<>$_SERVER['SERVER_NAME']){ $reslutstr=iconv("UTF-8", "gb2312", base64_decode($types));}
    return $reslutstr;
}
function Smallfivesq(){
$types='6K+35L2/55So5q2j54mI5o6I5p2D6L2v5Lu277yM5o6I5p2D6K+36IGU57O7UVHvvJoxNTQyMzY3Nzky';
return iconv("UTF-8", "gb2312", base64_decode($types));
}

?>