<?php

$query = $db->get_col ( 'users', array ('email' => $uemail ), array ('password' ) );

if (isset ( $_POST ['submit'] ) || $_POST ['check'] == 'password') {
	
	$getvalue = $_POST ['password'];
	
	$oldpass = $getvalue ['oldpass'];
	$encrypt_pass = $password->stringbreak ( $oldpass );
	if ($query [0] != $encrypt_pass) {
		?>
<div class="hide1">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-2" class="gritter-item-wrapper gritter-warning"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">
				<div class="gritter-close" id="gritterremove"
					style="display: inline;"></div>
				<h5>Warning! Your old password is wrong...</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	} else if ($query [0] == $encrypt_pass && $getvalue ['newpass'] != $getvalue ['conpass']) {
		?>
<div class="hide1">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-2" class="gritter-item-wrapper gritter-warning"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">
				<div class="gritter-close" id="gritterremove"
					style="display: inline;"></div>
				<h5>Warning! Your new password and confirm password is not match...
				</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	} else if ($query [0] == $encrypt_pass && $getvalue ['newpass'] == $getvalue ['conpass']) {
		$encrypt_conpass = $password->stringbreak ( $getvalue ['conpass'] );
		$query1 = $db->update ( 'users', array ('password' => $encrypt_conpass ), array ('email' => $uemail ) );
		if ($query1) {
			?>
<div id="hide">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-1" class="gritter-item-wrapper gritter-success"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">

				<div class="gritter-without-image">
					<span class="gritter-title">Cheers..
						<div class="gritter-close" id="gritterremove"
							style="display: inline;"></div>
					</span>
					<p>Your Password Is Changed...</p>
				</div>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>

<?php
		
		}
	}
}
?>