<?php
/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
if(cd_weboffa=='no') {exit("<meta charset=\"gb2312\"/><div align=\"center\"><br><br><br><font color=\"red\" size=\"6\">" . cd_weboffb . "</font></div>");}
if(($_COOKIE["cd_name"]<>"") || ($_COOKIE["cd_password"]<>"")) {
	$userid=$_COOKIE["cd_id"];
	$username=$_COOKIE["cd_name"];
	$password=$_COOKIE["cd_password"];
	global $db;
	$cd_ids=$db->getrow("select cd_id,cd_logintime from " . tname('session') . " where cd_uid=$userid and cd_uname='$username'");
	if($cd_ids["cd_id"]) {
		$deltime=$cd_ids["cd_logintime"]-cd_onlinehold;
		if(time()-$cd_ids["cd_logintime"]>cd_onlinehold) {$db->query("delete from " . tname('session') . " where (cd_logintime < '$deltime')");}
		$db->query("update " . tname('session') . " set cd_logintime='" . time() . "' where cd_uid=$userid");
		$sql="select * from " . tname('user') . " where cd_lock=0 and cd_id=$userid and cd_name='$username' and cd_password='$password'";
		$result=$db->query($sql);
		if($row=$db->fetch_array($result)) {
			$userlogined="true";
			$CcTvAi_com_userid=$row["cd_id"];
			$CcTvAi_com_username=$row["cd_name"];
			$CcTvAi_com_nicheng=$row["cd_nicheng"];
			$CcTvAi_com_password=$row["cd_password"];
			$CcTvAi_com_email=$row["cd_email"];
			$CcTvAi_com_sex=$row["cd_sex"];
			$CcTvAi_com_regdate=$row["cd_regdate"];
			$CcTvAi_com_loginip=$row["cd_loginip"];
			$CcTvAi_com_loginnum=$row["cd_loginnum"];
			$CcTvAi_com_qq=$row["cd_qq"];
			$CcTvAi_com_logintime=$row["cd_logintime"];
			$CcTvAi_com_grade=$row["cd_grade"];
			$CcTvAi_com_vipgrade=$row["cd_vipgrade"];
			$CcTvAi_com_lock=$row["cd_lock"];
			$CcTvAi_com_points=$row["cd_points"];
			$CcTvAi_com_photo=$row["cd_photo"];
			$CcTvAi_com_sign=$row["cd_sign"];
			$CcTvAi_com_hidden=$row["cd_hidden"];
			$CcTvAi_com_birthprovince=$row["cd_birthprovince"];
			$CcTvAi_com_birthcity=$row["cd_birthcity"];
			$CcTvAi_com_resideprovince=$row["cd_resideprovince"];
			$CcTvAi_com_residecity=$row["cd_residecity"];
			$CcTvAi_com_birthday=$row["cd_birthday"];
			$CcTvAi_com_vipindate=$row["cd_vipindate"];
			$CcTvAi_com_vipenddate=$row["cd_vipenddate"];
			$CcTvAi_com_vipgrade=$row["cd_vipgrade"];
			$CcTvAi_com_viprank=$row["cd_viprank"];
			$CcTvAi_com_verified=$row["cd_verified"];
			$CcTvAi_com_djmub=$row["cd_djmub"];
			$CcTvAi_com_ufav=$row["cd_ufav"];
			$CcTvAi_com_ufans=$row["cd_ufans"];
			$CcTvAi_com_hits=$row["cd_hits"];
			$CcTvAi_com_isbest=$row["cd_isbest"];
			$CcTvAi_com_money=$row["cd_money"];
			$CcTvAi_com_weblock=$row["cd_weblock"];
			$CcTvAi_com_signd=$row["cd_signd"];
			$CcTvAi_com_signdcumu=$row["cd_signdcumu"];
			$CcTvAi_com_signdtime=$row["cd_signdtime"];
			$CcTvAi_com_skin=$row["cd_skin"];
			$CcTvAi_com_friendnum=$row["cd_friendnum"];
			$CcTvAi_com_creditname=$row["cd_creditname"];
			$CcTvAi_com_rank=$row["cd_rank"];
			$CcTvAi_com_credit=$row["cd_credit"];
			$CcTvAi_com_qqopenid=$row["cd_qqopenid"];
			$CcTvAi_com_checkmm=$row["cd_checkmm"];
			$CcTvAi_com_checkmusic=$row["cd_checkmusic"];
			$CcTvAi_com_groupnum=$row["cd_groupnum"];
			$CcTvAi_com_level=$row["cd_level"];
		} else {
			$userlogined="false";
			$CcTvAi_com_grade=0;
			setcookie("cd_id", "", time()-3600, cd_cookiepath);
			setcookie("cd_name", "", time()-3600, cd_cookiepath);
			setcookie("cd_password", "", time()-3600, cd_cookiepath);
			//die(escape("Err_106"));
		}
	} else {
		$userlogined="false";
		$CcTvAi_com_grade=0;
		setcookie("cd_id", "", time()-3600, cd_cookiepath);
		setcookie("cd_name", "", time()-3600, cd_cookiepath);
		setcookie("cd_password", "", time()-3600, cd_cookiepath);
	}
}
?>