<?php
function str_post($rows){
	foreach($rows as $k=>$row){
		$data.="$k=".urlencode($row)."&";
	}
	return rtrim($data,'&');
}

function send_mail($to, $sub, $msg, $config) {
	include_once 'smtp.class.php';
	$From = $config['mail_email'];
	$Host = $config['mail_host'];
	$Port = $config['mail_port'];
	$SMTPAuth = 1;
	$Username = $config['mail_email'];
	$Password = $config['mail_pwd'];
	$Nickname = $config['web_name'];
	$SSL = false;
	$mail = new SMTP($Host , $Port , $SMTPAuth , $Username , $Password , $SSL);
	$mail->att = array();
	if($mail->send($to , $From , $sub , $msg, $Nickname)) {
		return true;
	} else {
		return $mail->log;
	}
}

function send_active_mail($mail,$do='SID',$qq,$config){
	$sub="秒赞网{$do}过期提醒";//邮件标题
	$msg="您好。你在".$config['web_name']."[".$config['web_domain']."]"."添加的QQ:{$qq}的{$do}已经过期，为了不影响你的正常使用，尽快到<a href='http://".$_SERVER['SERVER_NAME']."'>".$config['web_name']."</a>更新你的{$do}!";//邮件内容
	send_mail($mail, $sub, $msg, $config);
}
	if($qzone->sidzt){
		include_once "getskey.php";
		@mysql_query("UPDATE {$tableqz}qqs SET sidzt='1',skeyzt='1' WHERE qid='{$qid}'");
		$mail='SID';
	}
	if($qzone->skeyzt){
		include_once "getskey.php";
		$sql="skeyzt='1'";
		if($row[iszan]){
			$sql.=",iszan=1";
		}
		if($row[isreply]){
			$sql.=",isreply=1";
		}
		if($row[isshuo]){
			$sql.=",isshuo=1";
		}
		if($row[isqd]){
			$sql.=",isqd=1";
		}
		if($row[isdel]){
			$sql.=",isdel=1";
		}
		if($row[iszyzan]){
			$sql.=",iszyzan=0";
		}
		if($row[iszf]){
			$sql.=",iszf=1";
		}
		@mysql_query("UPDATE {$tableqz}qqs SET {$sql} WHERE qid='{$qid}'");
		$mail='SKEY';
	}
	if($_GET['get']){
		print_r($qzone->msg);
		print_r($qzone->error);
	}
	if($mail){
		$userresult = mysql_query("SELECT mail FROM {$tableqz}users where uid='{$row['uid']}' limit 1");
		if($user=mysql_fetch_array($userresult)){
			send_active_mail($user['mail'],$mail,$uin,$config);
		}
	}