<?php
if ( !defined( 'SMARTY_DIR' ) ) {
	include_once( '../init.php' );
}

include ( 'sessioninc.php' );

define( 'PAGE_ID', 'admin_mgt' );

if ( !checkAdminPermission( PAGE_ID ) ) {

	header( 'location: not_authorize.php' );
	exit;
}

$id = $_POST['txtid'];

$fullname = $_POST['txtfullname'];

$superuser = $_POST['txtsuperuser'];

$enabled = $_POST['txtenabled'];


$err = 0 ;


if ( $fullname == '' ) {

	$err = FULLNAME_BLANK;	// change to a constant later
}

if ( $err > 0 ) {

	header( 'location: manageadmin.php?edit=' . $id . '&errid=' . $err );
	exit;
}

$osDB->query( 'UPDATE ! SET fullname = ?, super_user = ?, enabled = ? WHERE id = ?', array( ADMIN_TABLE, $fullname, $superuser, $enabled, $id ) );

header( 'location: manageadmin.php' );

exit;

?>