<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');

global $baseurl,$basedir,$image_dpath, $image_vpath;
if($id=="Check_log"){
	$db=mysqli_query($GLOBALS['conn'],"select * from admin_login where admin_User='$old_user_name' and admin_Pass='$old_password' and admin_Accessid='$old_accessid'");
		if(mysqli_num_rows($db)>0){
			mysqli_query($GLOBALS['conn'],"update admin_login set admin_User='$new_user_name',admin_Pass='$new_password',admin_Accessid='$new_accessid'");
			session_destroy();
			header("Location:index.php");
			exit;
		}
		else{
			$msg="XX";
			header("Location:$PHP_SELF?msg=$msg");
		}
}
$title="Manage Update Admin Password Section";
admin_header($title);
?>
<br><br>
<table width="70%" border="0" cellpadding="4" cellspacing="1" align="center" id="box4" valign="top">
	<?php
	if($_REQUEST[msg]=="XX"){
		?>
		<tr>
			<td colspan="2"  align="center" ><span class="red"><b>Sorry!! Your Are Not The Valid User.</b></span><br>
			</td>
		</tr>
		<?php
	}
	?>
	<tr>
		<td colspan="2"  align="center" class="lightBorder myHead"><b>Change Admin Passwords</b></td>
	</tr>
	<tr>
		<td width="20%" align="center" valign="middle" class="lightBorder"><img src="images/change_password.gif"></td>
		<td  width="80%" class="lightBorder" valign="top">
			<form name="log_frm" action="<?=$PHP_SELF;?>" method="post" onSubmit="return Check_log();">
			<table width="100%" border="0" cellpadding="4" cellspacing="1" align="center" id="box3" valign="top">
				<tr>
					<td class="lightBorder" align="center" colspan="3"><strong>Admin Old Details</strong></td>
				</tr>
				<tr>
					<td>Old User Name</td>
					<td>:</td>
					<td><input class="input" type="text" name="old_user_name"></td>
				</tr>
				<tr>
					<td>Old Password</td>
					<td>:</td>
					<td><input class="input" type="password" name="old_password"></td>
				</tr>
				<tr>
					<td>Old Access ID</td>
					<td>:</td>
					<td><input class="input" type="password" name="old_accessid"></td>
				</tr>
				<tr>
					<td class="lightBorder" align="center" colspan="3"><strong>Admin New Details</strong></td>
				</tr>
				<tr>
					<td>New User Name</td>
					<td>:</td>
					<td><input class="input" type="text" name="new_user_name"></td>
				</tr>
				<tr>
					<td>New Password</td>
					<td>:</td>
					<td><input class="input" type="password" name="new_password"></td>
				</tr>
				<tr>
					<td>New Access ID</td>
					<td>:</td>
					<td><input class="input" type="password" name="new_accessid"></td>
				</tr>
				<tr>
					<td colspan="3" align="center"><input class="button" type="submit" name="submit" value="Enter">&nbsp;&nbsp;<input class="button" type="reset" name="reset" value="Reset"><input class="button" type="hidden" name="id" value="Check_log"></td>
				</tr>
			</table>
			</form>
		</td>
	</tr>
</table>
<br><br><br><br><br><br><br>
<?php
admin_footer();
?>