<?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_type='admin'");	
	if($res[pwd]==$old_password){
		//Updating data.
		updateTable("admin_details"," user_id='$username', pwd='".$password."' where user_type='admin'");
		session_unregister("MyCpanel");
		session_destroy();
		//header("Location:index.php");
		
        echo "<script>window.location.href='index.php';</script>";

	}
	else{
		$_SESSION['session_message']="Invalid current password. Please Try Again!!";
		//header("location:admin_change_pass.php");

		
        echo "<script>window.location.href='admin_change_pass.php';</script>";

		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();
?>