<?php session_start();  //Developed by ITechScripts
?>
<?
if(strlen($_SESSION["adminuser"])==0)
{
//echo '<meta http-equiv="refresh" content="0; url=index.php">';
//exit();
}
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/argvs.php'; // ITECHBIDS Configuration File
if(strlen($_POST['btn_Save'])) 
{
	$opass=$_POST['txtOPass'];
	$npass=$_POST['txtNPass'];
	$rpass=$_POST['txtRPass'];
$opass = seccheck($opass);
$npass = seccheck($npass);
$rpass = seccheck($rpass);
	if($opass=='') $o_flag=1;
	if($npass=='') $n_flag=1;
	if($npass!=$rpass) $r_flag=1;
	if($o_flag!=1 && $n_flag!=1 && $r_flag!=1) {
		$chk_sql="select * from admin where password='$opass'";
		$chk_res=mysql_query($chk_sql);
		if(mysql_num_rows($chk_res)>0) {
			$up_sql="update admin set password='$npass' where password='$opass'";
			 $up_res=mysql_query($up_sql);
			if($up_res) $suc_flag=1;
			else $err_flag=1;
		}
		else {
			$wrong_pass=1;
		}
	}
}
?>

<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
-->
</style><?php
require 'include/header.php';
?>
<br>
<table border="0" align="center" cellpadding="5" cellspacing="2" width="80%" class="ft">
<form name="frmPass" action="<? $_SERVER['PHP_SELF']?>" method="post">
<tr ><td colspan="2" class="ct" height="25">Change Password</td></tr>
<?
	if($suc_flag==1) {
?>
<tr >
<td colspan="2"><b>Thank You, Your Password has been Sucessfully Changed</b></td>
</tr>
<?
	}
	if($err_flag==1) {
?>
<tr >
<td colspan="2"><font color="red">Sorry, There is a Problem in Changing your Password now, Try Again Later</td>
</tr>
<?
	}
	if($wrong_pass==1) {
?>
<tr >
<td colspan="2"><font color="red">The Password you have Provided does not match with your Old Password</td>
</tr>
<?
	}
	if($o_flag==1 || $n_flag==1 || $r_flag==1) {
?>
<tr >
<td colspan="2"><font color="red">Please Fill the Information denoted in Red</font></td>
</tr>
<?
	}
?>
<tr >
<td><? if($o_flag==1) echo '<font color=red>';?>Old Password</td>
<td><input type="password" name="txtOPass" ></td>
</tr>
<tr >
<td><? if($n_flag==1) echo '<font color=red>';?>New Password</td>
<td><input type="password" name="txtNPass" ></td>
</tr>
<tr >
<td><? if($r_flag==1) echo '<font color=red>';?>Re-Enter Password</td>
<td><input type="password" name="txtRPass" ></td>
</tr>
<tr ><td colspan="2" align="center"><input type="submit" class="button"   name="btn_Save" value=" Change " ></td></tr>
</form>
</table>
<?
	require 'include/footer.php';
?>