<?php require_once("header.php");?>

<?php
if(isset($_POST['send']))
{	
	$sql_update = "UPDATE `og_users` SET `password` = '".md5($_POST['password'])."',`original_password` = '".$_POST['password']."' WHERE `user_id` = '".$_POST['hid_uid']."'";
	$exe_update = mysqli_query($connection,$sql_update);

    $_SESSION['sec_msg'] = 'Password reset successfully.';
	header("location: reset-password.php?uid=".$_POST['hid_uid']);
    exit;
}
?>

			<script language="javascript" type="text/javascript">
			function form_validation()
			{
				if(document.getElementById('password').value == "")
    			{
    				alert("Please enter password");
    				document.getElementById('password').focus();
    				return false;
    			}
    		   
    			if(document.getElementById('cpassword').value == "")
    			{
    				alert("Please enter confirm password");
    				document.getElementById('cpassword').focus();
    				return false;
    			}
    			
    			if(document.getElementById('cpassword').value != document.getElementById('password').value)
    			{
    				alert("Password and confirm password should be same");
    				document.getElementById('cpassword').focus();
    				return false;
    			}
			}
			</script>

			<!-- page template area start -->
    			<section id="about">
    				<div class="container mt-10 pb-10 pt-5">
    					<div class="row">
    						<div class="col-md-7">
    							<h1 class="title mt-0 mb-10">Reset Password</h1>
								<?php if(isset($_SESSION['sec_msg'])) { ?>
        						<p><img src="images/tick.png" alt="" /> <?php echo $_SESSION['sec_msg'];?></p>
        						<?php 
        						unset($_SESSION['sec_msg']);
        						} 
        						?>	
    							<form id="" action="" method="post" enctype="multipart/form-data" class="contact-form" onsubmit="return form_validation();">
        						<div class="row">
        							<div class="col-lg-12 form-group">
        								<input name="password" id="password" placeholder="Enter Password *" class="common-input form-control" type="password">
        							</div>
        							<div class="col-lg-12 form-group">
        								<input name="cpassword" id="cpassword" placeholder="Enter Confirm Password *" class="common-input form-control" type="password">
        							</div>
        							<div class="col-lg-12 form-group">
    								    <button class="btn btn-flat btn-theme-colored border-left-theme-color-2-4px" type="submit" style="float: left;">Reset</button><input type="hidden" name="send" id="send" value="1" /><input type="hidden" name="hid_uid" id="hid_uid" value="<?php echo $_GET['uid'];?>" />
    							    </div>
    							</div>
    							</form>
    							<div style="clear:both;">&nbsp;</div>
    						</div>
    						<div class="col-md-5">
							<div class="row">
								<div class="col-xs-12 col-sm-12 col-md-12">
									<div class="icon-box left media p-25 mb-20" style="background:#34A853; border-radius:5px;"> <a class="media-left pull-left" href="#"> <i class="pe-7s-map-2 text-theme-color-2"></i></a>
										<div class="media-body">
										    <h2 style="margin:0 0 10px 0; color:#fff;">Our Address</h2>
											<p class="text-white"><?php echo nl2br($contact_address);?></p>
										</div>
									</div>
								</div>
								<div class="col-xs-12 col-sm-6 col-md-12 text-white">
									<div class="icon-box left media p-25 mb-20" style="background:#34A853; border-radius:5px;"> <a class="media-left pull-left" href="#"> <i class="pe-7s-call text-theme-color-2"></i></a>
										<div class="media-body">
										    <h2 style="margin:0 0 10px 0; color:#fff;">Our Contact Number</h2>
											    <p><?php echo $contact_no1;?><?php if($contact_no2!="") { ?><br><?php echo $contact_no2;?><?php } ?></p>
										</div>
									</div>
								</div>
								<div class="col-xs-12 col-sm-6 col-md-12 text-white">
									<div class="icon-box left media p-25 mb-20" style="background:#34A853; border-radius:5px;"> <a class="media-left pull-left" href="#"> <i class="pe-7s-mail text-theme-color-2"></i></a>
										<div class="media-body">
										    <h2 style="margin:0 0 10px 0; color:#fff;">Our Contact Email</h2>
											    <p><?php echo $contact_email?></p>
										</div>
									</div>
								</div>
							</div>
						</div>
    					</div>
    				</div>
    			</section>
    		</div>
			<!-- page template area end -->

<?php require_once("footer.php");?>