<?php
require_once(dirname(__FILE__).'/../../config.php');
require_once(DIR_SYSTEM.'/admin/class.session.php');

$t	=	$prepare->sanitize( $_GET['t'], 'input');


if ( $t == 'update' ) {
$admin_name		=	$prepare->sanitize($_POST['name'],'input');
$admin_email	=	$prepare->sanitize($_POST['email'],'input');
$admin_password	=	$prepare->sanitize($_POST['password'],'input');
$admin_id		=	$_SESSION[ADMIN_SESSION]['0']['admin_id'];

	$update = $db->NoQuery("update administrator set admin_name=?, admin_email=? where admin_id=?","ssi",$admin_name,$admin_email,$admin_id);

	if ( !empty ( $admin_password ) ) {
		$md5_pw	=	md5( $admin_password );
		$db->NoQuery("update administrator set admin_password=? where admin_id=?","si",$md5_pw,$admin_id);
	}

	if ( $update ) {
		echo "<div id='mode'>1</div><div id='message'>". $LANG["WBS_ADMIN_PROFILE_UPDATED"] ."</div>";
	} else {
		echo "<div id='mode'>1</div><div id='message'>". $LANG["WBS_ADMIN_PROFILE_ERROR"] ."</div>";
	}

}


?>