<?php
require('ppframe.php');

if (!$base_config['passport_modify'] || $base_config['passport_method'] == 1) {
	ShowMessage('system.forbidden',-1,1);
}

#获得自定义字段
$selfdef_fields = GetTableFields($rtc['passport_table'],'selfdef_%');
$mydef_fields = GetTableFields($rtc['passport_table'],'mydef_%');
#获得自定义字段

if(isset($Submit)) {
//	$_POST['uid'] = $passport -> U_ID;
	if(!eregi('^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $email)) {
		ShowMessage('email.error');
	}
	$passport -> SetUpdateInfo($_POST);
	$safearray = array('email');
	foreach ($selfdef_fields as $k => $v) {
		if (ereg('_no_',$v[0]) && $passport->U[$v[0]]) {
			continue;
		}else {
			$safearray[] = $v[0];
		}
	}
	foreach ($mydef_fields as $k => $v) {
		if (ereg('_no_',$v[0]) && $passport->U[$v[0]]) {
			continue;
		}else {
			$safearray[] = $v[0];
		}
	}
	
	if($passport -> DoReRecord($safearray)) {
		ShowMessage('do.success');
	}else {
		ShowMessage('do.fail');
	}
}else {
	Iimport('template');
	$tpl = new Template();
	$tpl -> LanguageAssign('title','passport.update');
	$tpl -> DisPlay('update');
}
?>