<?php
switch ($act) {
	case 'add':
		//订阅到qq
		$setting = cache::get('email');
		$setting_qq = array();
		foreach ($setting as $v) {
			if (stripos($v['email_smtp'], 'qq.com') === false or !$v['email_qqid'])continue;			             $setting_qq[] = $v;
		}
		$setting_qq && $dingyue_qq = $setting_qq[array_rand($setting_qq,1)];
		!$setting_qq && $formfalse = 'return false;';
$html = <<<html
	<form action='http://list.qq.com/cgi-bin/qf_compose_send' method='post' target='_blank'>
	<div class="zhuce">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td width="100" align="right">姓名：</td>
			<td width="220"><input type="text" name="info[rssuser_name]" class="input3" id="rssuser_name" /></td>
			<td width="100" align="right">邮箱：</td>
			<td width="230"><input type="text" name="to" class="input3" id="rssuser_email" /></td>
			<td>
				<input type='hidden' name='t' value="qf_booked_feedback" />
				<input type='hidden' name='id' value="{$dingyue_qq['email_qqid']}" />
				<input type="submit" name="pesubmit" class="tjbtn3 js_rssuser" style="cursor:pointer" value="订阅" />
			</td>
		</tr>
		</table>
	</div>
	<div class="mat10" style="text-align:center">
		<input class="js_rssuser" name="pesubmit" type="image" src="{$pe['host_root']}template/default/index/images/reg.gif" />
	</div>
	</form>
<script type="text/javascript">
pe_inputdefault('rssuser_name','仅限中文。');
pe_inputdefault('rssuser_email','填写有效邮箱才收到赠品哦！');
$(function(){
$(".js_rssuser").click(function() {
	$.ajaxSettings.async = false;
	var result = true;
	var rule_abc = /^[A-Za-z0-9]+$/;
	if (rule_zh.test($("#rssuser_name").val()) == false) {
		alert('姓名仅限中文。');
		return false;
	};
	if (rule_email.test($("#rssuser_email").val()) == false) {
		alert('邮箱格式不正确');
		return false;
	};
	$.getJSON("{$pe['host_root']}user.php",{"mod":"do", "act":"rssuser_add", "type":"checkemail", "rssuser_email" : $("#rssuser_email").val()}, function(json){
		result = json.result;
	});
	if (result == false) {
		alert('请勿重复订阅');
		return false;
	};
	$.getJSON("{$pe['host_root']}user.php",{"mod":"do", "act":"rssuser_add", "type":"submit", "rssuser_name" : $("#rssuser_name").val(), "rssuser_email" : $("#rssuser_email").val(), "package_id" : '{$_g_package_id}'}, function(json){
		result = json.result;
	});
	if (result == 'haveone') {
		alert('请勿重复订阅...');
		return false;
	};
	if (result == false) {
		alert('订阅失败...');
		return false;	
	};
	{$formfalse}
})
})
</script>
html;
	echo pe_jstext($html);
	break;
}
?>