<?php
/****************优客365网址导航系统 商业版********************/
/*                                                            */
/*  Youke365.com (C)2017 Youke365 Inc.                        */
/*  This is NOT a freeware, use is subject to license terms   */
/*  优客365网址导航系统是商业软件,使用于商业用途请购买授权    */
/*  V1.0 2017                                                 */
/*  技术支持：1513773524@qq.com                               */
/*  官方网址：http://www.youke365.com                         */
/*  官方论坛：http://bbs.youke365.com                         */                           
/**************************************************************/

if (!defined('IN_YOUKE365')) exit('Access Denied');

$user_email = $myself['user_email'];
$verify_code = random(32);

$active_link = "$options[site_url]member/?mod=activate&uid=$myself[user_id]&code=$verify_code";
//发送邮件
if (!empty($options['smtp_host']) && !empty($options['smtp_port']) && !empty($options['smtp_auth']) && !empty($options['smtp_user'])  && !empty($options['smtp_pass'])) {
	require(CORE_PATH.'include/sendmail.php');
		
	$smarty->assign('site_name', $options['site_name']);
	$smarty->assign('site_url', $options['site_url']);
	$smarty->assign('user_email', $user_email);
	$smarty->assign('active_link', $active_link);
	$mailbody = $smarty->fetch('verify_mail.html');
	
	if (sendmail($user_email, '['.$options['site_name'].'] E-mail地址验证！', $mailbody)) {
		$DB->update($DB->table('users'), array('verify_code' => $verify_code, 'join_time' => time()), array('user_id' => $myself['user_id']));
		msgbox('验证邮件发送成功！', '?mod=home');
	} else {
		msgbox('验证邮件发送失败！请稍后再试……', '?mod=home');
	}
}else{
	echo '系统未开通邮件功能';
}
?>
