<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');
#Edit Section
if($action=="Update"){
	@extract($_POST);
	$res=getResult("admin_details"," where user_id='".$_SESSION['MyAdminUserID']."' and user_type='staff'");	
	if($res[pwd]==$old_password){
		//Updating data.
		updateTable("admin_details"," user_id='$username', pwd='".$password."' where user_id='".$_SESSION['MyAdminUserID']."' and user_type='staff'");
		session_destroy();
		header("Location:index.php");
	}
	else{
		$_SESSION['session_message']="Invalid current password. Please Try Again!!";
		header("location:admin_staff_change_pass.php");
		exit();	
	}
}

admin_header();
?>
<table width="99%" cellpadding="2" cellspacing="1" border="0" valign="top">
 <tr valign="top"><td class="myTitle" align="left"><strong><?=$title;?></strong></td></tr>	
</table>
<hr size="2" width="99%" color="#DA251C">
<?php
admin_change_pass();
?>
<br/><br/>
<?php
admin_footer();
?>