<?php 
ob_start();
session_start();
include("config.php");

@$mobile= mysqli_real_escape_string($com,$_POST['mobile']);
@$password=mysqli_real_escape_string($com,$_POST['password']);
@$oldpassword=mysqli_real_escape_string($com,$_POST['oldpassword']);


//@$otp=$_POST['otp'];
//@$sssotp =$_POST['sssotp'];
//  if($otp == $sssotp)
//  {
  
$sqllog = mysqli_fetch_assoc(mysqli_query($com,"select * from loginuser where mobile='$mobile'"));
$showpassword = $sqllog['show_password'];

$pass = md5($password);
 if($showpassword == $oldpassword)
 {
   $sql = "UPDATE loginuser SET password='$pass',show_password='$password' WHERE mobile='$mobile'";
      $select=mysqli_query($com,$sql);
      echo "<script type='text/javascript'>alert('Successfully Update'); window.location='login.php';</script>";
}else{
	    echo "<script type='text/javascript'>alert('Old password not match'); window.location='forgot-password.php';</script>";
	}

?>