<?php
/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: site_settings_load_account.php 10953 2009-01-12 02:55:37Z liguode $
*/

if(!defined('IN_UCHOME')) {
	exit('Access Denied');
}
@include_once(S_ROOT.'./data/site_config.php');
$list = $bar = $desktop = $rsslist = array();
$cdtat_start = '****----****';
$cdtat_end = '####----####';
$arrow = '$';
$desktopId = 0;
if ( !empty($_SGLOBAL['supe_uid']) )
{
	$display = true;
	//获取空间信息
	$space = getspace($_SGLOBAL['supe_uid']);
	if(isset( $_GET['action'] ) && $_GET['action'] == 'save') 
	{
		
		//检查邮箱
		$_POST['email'] = isemail($_POST['email'])?$_POST['email']:'';
		if(empty($_POST['email'])) {
			//showmessage('email_error');
			$msg = 1;
		}
		//验证密码
		if($_POST['email'] != $space['email']) {
			if(!$passport = getpassport($_SGLOBAL['supe_username'], addslashes($_POST['password']))) {
				//showmessage('password_is_not_passed');
				$msg = 2;
			}
			else
			{
				//更新资料
				$space['email'] = $_POST['email'];
				updatetable('spacefield', array('email'=>$_POST['email'], 'emailcheck'=>0), array('uid'=>$space['uid']));
				$mailhash = md5($space['email'].'|'.md5($_SCONFIG['sitekey']).'|'.$space['uid']);
				$siteurl = getsiteurl();
				$checkurl = $siteurl.'cp.php?ac=sendmail&amp;op=check&amp;hash='.$mailhash;
				$mailsubject = cplang('active_email_subject');
				$mailmessage = cplang('active_email_msg', array($checkurl));
				smail(0, $space['email'], $mailsubject, $mailmessage);
				$msg = 3;
			}
		}
	}
}
else
{
	$display = false;
}
?>