<?php
if ( !defined( "SAXUE_CORE_INCLUDE" ) ) {
		include "../../core.php";
} 
saxue_checkpower( 'memberaccount' );
$uid = intval( $_REQUEST['uid'] );
if ( empty( $uid ) ) {
		saxue_printfail( LANG_NO_USER );
}
include SAXUE_ROOT_PATH . "/model/member_account.php";
$account_handler = &saxuememberaccounthandler :: getinstance( "saxuememberaccounthandler" );
$account = $account_handler -> get( $uid );
if ( !is_object( $account ) ) {
		saxue_printfail( LANG_NO_USER );
} 
if ( isset( $_POST['dosubmit'] ) ) {
		$_POST['uid'] = $uid;
		$_POST['bank'] = trim( $_POST['bank'] );
		$_POST['payee'] = trim( $_POST['payee'] );
		$_POST['account'] = trim( $_POST['account'] );
		$_POST['updatetime'] = SAXUE_NOW_TIME;
		$newaccount = $account_handler -> create( false );
		if ( !$account_handler -> insert( $newaccount ) ) {
				exit( json_encode( array( 'flag' => 0, 'msg' => LANG_ERROR_DATABASE ) ) );
		} 
		exit( json_encode( array( 'flag' => 1 ) ) );
}
include SAXUE_ADMIN_PATH . "/header.php";
$saxueTpl -> assign_by_ref( "row", $account -> getvars( "n" ) );
$saxueTpl -> setcaching( 0 );
$saxueTset['saxue_contents_template'] = SAXUE_WEB_PATH . "/member/templates/account_edit.html";
include SAXUE_ADMIN_PATH . "/footer.php";