<?php
/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: site_settings_load_account_password.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' ) 
	{
		if($_POST['userpass_new'] != $_POST['userpass_new_repeat']) {
			//showmessage('password_inconsistency');
			$msg = 1;
		}
		elseif($_POST['newpasswd1'] != addslashes($_POST['newpasswd1'])) {
			//showmessage('profile_passwd_illegal');
			$msg = 2;
		}
		else
		{
			@include_once(S_ROOT.'./uc_client/client.php');
			
			$ucresult = uc_user_edit($_SGLOBAL['supe_username'], $_POST['userpass'], $_POST['userpass_new'], $space['email']);

			if($ucresult == -1) {
				//showmessage('old_password_invalid');
				$msg = 3;
			} elseif($ucresult == -4) {
				//showmessage('email_format_is_wrong');
				$msg = 4;
			} elseif($ucresult == -5) {
				//showmessage('email_not_registered');
				$msg = 5;
			} elseif($ucresult == -6) {
				//showmessage('email_has_been_registered');
				$msg = 6;
			} elseif($ucresult == -7) {
				//showmessage('no_change');
				$msg = 7;
			} elseif($ucresult == -8) {
				//showmessage('protection_of_users');
				$msg = 8;
			}
			else{
				clearcookie();
				//showmessage('getpasswd_succeed', 'do.php?ac='.$_SCONFIG['login_action']);
				$msg = 9;
			}
		}
	}
}
else
{
	$display = false;
}
?>