<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');
#Edit Section
if($_POST['action']=="Update"){
	$username = $_POST['username'];
    $password = $_POST['password'];
    $old_password = $_POST['old_password'];
	$res=getResult("admin_details"," where user_type='admin'");	
    print_r($res);
	if($res['pwd']==$old_password){
		//Updating data.
		updateTable("admin_details"," user_id='$username', pwd='".$password."' where user_type='admin'");
		session_unset("MyCpanel");
		session_destroy();
		header("Location:index.php");
	}
	else{
		$_SESSION['session_message']="Invalid current password. Please Try Again!!";
		header("location:admin_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();
?>