<?php
session_start();
include "control/activity.php";
$dd = new activity();


$table = "admin_calculation";
$condition = null;
$getAdminDetails = $dd->single($table,$condition);
$teligram = $getAdminDetails['telegram'];
$loginImg = $getAdminDetails['login_img'];

?>


<!DOCTYPE html>
<html lang="en" translate="no">
<head>
    <meta charset="UTF-8">
    <link rel="icon" type="image/svg+xml" href="./images/h5setting_20230808033047vpbk.ico">
    <meta name="google" content="notranslate">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title><?= $getAdminDetails['title']; ?></title>
    <link rel="stylesheet" href="css/slick.css" />
    <link rel="stylesheet" href="css/modules.css" />
    <link rel="stylesheet" href="css/style.css" />
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/slick.min.js" type="text/javascript"></script>
    <script src="js/main.js" type="text/javascript"></script>
</head>
<body>
    <div id="app">
        <div class="login__container">
            <div class="navbar">
                <div class="navbar-fixed" style="background: linear-gradient(90deg, rgb(206, 2, 4) 0%, rgb(242, 64, 58) 100%);">
                    <div class="navbar__content">
                        <div onclick="getBack()" data-v-905dfe8c="" class="navbar__content-left"><div data-v-905dfe8c="" class="backIcon"></div></div>
                        <div data-v-905dfe8c="" class="navbar__content-center">
                            <div data-v-905dfe8c="" class="headLogo" style="background-image: url(&quot;temp_img/<?= $loginImg; ?>&quot;);"></div>
                            <div data-v-905dfe8c="" class="navbar__content-title">
                        </div>
                        <div data-v-905dfe8c="" class="navbar__content-right"><div data-v-4eb25d27="" data-v-ee3ddeea=""><!----></div></div>
                    </div>
                    </div>
                </div>
            </div>
<script>
    function getBack()
    {
        window.open('login.php','_self');
    }
</script>
            <div class="login__container-heading">
                <h1 data-v-ee3ddeea="" class="login__container-heading__title">Forgot password</h1>
                <div class="login__container-heading__subTitle">
                <div data-v-e31d5956="">Please retrieve/change your password through your mobile phone number or email</div>
                </div>
            </div>

            <div class="login_container-tab">
                <div class="tab active">
                    <div data-v-e31d5956="" class="phonebg phoneactive"></div>
                    <div data-v-e31d5956="" class="font30 phonefont30active">phone reset</div>
                </div>
            </div>

            <div class="rpwd__C-form">
                <div class="tab-content activecontent">
                    <form method="post">
                    <div class="register__container">
                        <div class="phoneInput__container">
                            <div class="input-label phoneInput__container-label">
                                <img data-v-5f6a9e3a="" src="images/phone-mob-icon.png" class="phoneInput__container-label__icon">
                                <span data-v-5f6a9e3a="">Phone number</span>
                            </div>  

                            <div class="phoneInput__container-input">
                                <div data-v-4fa0be24="" data-v-5f6a9e3a="" class="dropdown"><div data-v-4fa0be24="" class="dropdown__value"><span data-v-4fa0be24="">+91</span><i data-v-4fa0be24="" class="van-badge__wrapper van-icon van-icon-arrow-down"><!----><!----><!----></i></div></div>
                                <input required data-v-5f6a9e3a="" id="getmobile" onKeyUp="getMobileNumber()" type="text" name="userNumber" placeholder="Please enter the phone number">
                            </div>  
                        </div>  
                        <div data-v-34ec8998="" data-v-df327280="" class="passwordInput__container">
                            <div data-v-34ec8998="" class="input-label phoneInput__container-label">
                                <img data-v-34ec8998="" class="passwordInput__container-label__icon" data-src="images/password-c2d8d12b.png" src="images/password-c2d8d12b.png" lazy="loaded" /><span data-v-34ec8998="">A new password</span>
                            </div>
                            <div data-v-34ec8998="" class="passwordInput__container-input">
                                <input id="new-password" name="password" required data-v-34ec8998="" type="password" placeholder="Please enterA new password" maxlength="15" autocomplete="new-password" />
                                <span toggle="#new-password" class="fa fa-fw fa-eye field-icon new-password">
                                    <img data-v-b0ac9d23="" src="images/view-icon.png" class="eye hid_pass">
                                    <img data-v-b0ac9d23="" src="images/eyeVisible-09720f5f.png" class="eye show_pass">
                                </span>
                            </div>
                        </div>

                        <div data-v-df327280="" class="register__container-tip" style="display: none;">
                            <div data-v-df327280="" class="tipbg"></div>
                            <span data-v-df327280="">The password must be at least 8 digits and must contain letters + numbers</span>
                        </div>

                        <div data-v-34ec8998="" data-v-df327280="" class="passwordInput__container">
                            <div data-v-34ec8998="" class="input-label phoneInput__container-label">
                                <img data-v-34ec8998="" class="passwordInput__container-label__icon" data-src="images/password-c2d8d12b.png" src="images/password-c2d8d12b.png" lazy="loaded" /><span data-v-34ec8998="">Confirm new password</span>
                            </div>
                            <div data-v-34ec8998="" class="passwordInput__container-input">
                                <input id="confirm-password" name="cpassword"  required data-v-34ec8998="" type="password" placeholder="Please enterConfirm new password" maxlength="15" autocomplete="new-password" />
                                <span toggle="#confirm-password" class="fa fa-fw fa-eye field-icon confirm-password">
                                    <img data-v-b0ac9d23="" src="images/view-icon.png" class="eye hid_pass">
                                    <img data-v-b0ac9d23="" src="images/eyeVisible-09720f5f.png" class="eye show_pass">
                                </span>
                            </div>
                        </div>
                       
                        <input id="frommob" name="otpp" type="hidden"/>
                        <input name="userKey" id="user" type="hidden"/>
                        <div data-v-df327280="" class="register__container-tips" style="display: none;"><span data-v-df327280="">Entered twice the password does not match!</span></div>

                        <div class="verifyInput__container">
                            <div class="verifyInput__container-label">
                                <img data-v-fcbacd84="" class="verifyInput__container-label__icon" data-src="images/verify-81c529c8.png" src="images/verify-81c529c8.png" lazy="loaded">
                                <span data-v-fcbacd84="">Verification Code</span>
                            </div>  
                            <div class="verifyInput__container-input">
                                <input  name="fromOtp"  required data-v-fcbacd84="" type="text" placeholder="Please enter the confirmation code" maxlength="6">
                                <button data-v-fcbacd84="" class=""><span data-v-fcbacd84="">Send</span></button>
                            </div>  
                            <div data-v-fcbacd84="" class="verifyInput__container-tip" style="display: none;">
                                <i data-v-fcbacd84="" class="van-badge__wrapper van-icon van-icon-warning-o"></i>
                                <span data-v-fcbacd84="">Did not receive verification code?</span>
                                <span data-v-fcbacd84="">Contact customer service</span>
                            </div>
                        </div>  
                        <div class="register__container-remember">
                                <label data-v-c16e655a="" class="van-checkbox" role="checkbox" tabindex="0" aria-checked="false">
                                <span class="van-checkbox__label">I have read and agree <span data-v-df327280="">【Privacy Agreement】</span></span>
                                    <input type="checkbox">
                                    <span class="checkmark"></span>
                                </label>
                            </div>
                       

                        <div data-v-df327280="" class="register__container-button"><button name="changePassword" data-v-df327280="">Reset</button></div>

                    </div>  
                </div> 
               </form> 
            </div>  

        </div>
    </div>
</body>

</html>



<?php
  if(isset($_REQUEST['changePassword']))
  {
     $fromOtp = $_REQUEST['fromOtp'];
     $otpp = $_REQUEST['otpp'];
     $password = $_REQUEST['password'];
     $cpassword = $_REQUEST['cpassword'];
     $userKey = $_REQUEST['userKey'];

     if($password==$cpassword)
     {
       if($fromOtp == $otpp)
       {
          $table = "userdetails";
          $value = "password='$password'";
          $condition = " userKey='$userKey'";
          $result = $dd->updateData($table,$value,$condition);
          if($result){
            echo "<script>alert('Password changed successfully..!!'),window.open('login.php','_self')</script>";
          }
       }else{
        echo "<script>alert('Sorry Otp not match..!!')</script>";
       }
     }else{
        echo "<script>alert('Sorry confirm password not match..!!')</script>";
     }

  }

?>




<script>
  function goRegister()
  {
      window.open('register.php','_self');
  }



  function getMobileNumber()
  {
    var mob = document.getElementById("getmobile").value;
    if(mob.length == 10)
    {
        const xhttp = new XMLHttpRequest();
        xhttp.onload = function() {
            var demo_show = this.responseText;
            const myArr = JSON.parse(demo_show);
            if(myArr.status == "success")
            {
                document.getElementById("user").value=myArr.user;
                document.getElementById("frommob").value=myArr.otp;
                document.getElementById("getmobile").disabled = true;
                alert('Otp Sending successfull');
            }
            else{
                alert(myArr.remark);
            }
        }
        xhttp.open("GET", "send_forget_otp.php?mob="+mob);
        xhttp.send();
    }
  }

  $(".confirm-password").click(function() {
        $(this).toggleClass("fa-eye fa-eye-slash");
        var input = $($(this).attr("toggle"));
        if (input.attr("type") == "password") {
        input.attr("type", "text");
        } else {
        input.attr("type", "password");
        }
    });

    $(".new-password").click(function() {
        $(this).toggleClass("fa-eye fa-eye-slash");
        var input = $($(this).attr("toggle"));
        if (input.attr("type") == "password") {
        input.attr("type", "text");
        } else {
        input.attr("type", "password");
        }
    });

</script>    



