MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.149.237.231
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/ltbuildcon.com/../overseasjunction.com/../deergham.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/ltbuildcon.com/../overseasjunction.com/../deergham.com/verify_otp_next.php
<?php
session_start();
include_once('admin/config.php');
    // $user_otp = $_POST['user_otp'];
    // $stored_otp = $_SESSION['otp'];
    // $mobile = $_SESSION['mobile'];
if (isset($_POST['otp_submit'])) {
    $user_otp = $_POST['user_otp'];
    $stored_otp = $_SESSION['otp'];
    $mobile = $_SESSION['mobile'];

    if ($user_otp == $stored_otp) {

        // Unset the OTP session to prevent reusing the OTP
        // unset($_SESSION['otp']);

        // Check if the mobile number, OTP, and timestamp are valid in the database
        $query = "SELECT * FROM tbl_customer WHERE cust_phone='$mobile' AND otp IS NOT NULL";
        $result = mysqli_query($db, $query);

        if (mysqli_num_rows($result) == 1) {
    $row = mysqli_fetch_assoc($result);
    $otp_generated_at = strtotime($row['otp_valid'] . ' Asia/Kolkata');
    $current_time = time();
    $otp_valid_duration = 30 * 24 * 60 * 60;

    if (($current_time - $otp_generated_at) <= $otp_valid_duration) {
        // Mobile number and OTP match, log in the user
        $_SESSION['user'] = $row; 
        $_SESSION['success'] = true;

        // Generate remember token
        // $remember_token = generateRememberToken();

        // Set remember token as cookie
        // $cookie_expiry = time() + (86400 * 30 * 12);
        // setcookie('remember_token', $remember_token, $cookie_expiry, '/');

        // Assuming you have a function to update remember token in the database
        // updateRememberToken($row['id'], $remember_token);

        header('location: index.html');
        exit();
    } else {
        echo "OTP has expired. Please request a new OTP.";
    }
} else {
            echo "OTP verification failed. Please enter the correct OTP.";
            header('location: login.php');
        }

    } else {
        echo "OTP verification failed. Please enter the correct OTP.";
        header('location: login.php');
    }
}
?>
<!DOCTYPE html>
<html lang=en>

<head>
    <meta charset=UTF-8>
    <meta name=viewport content="width=device-width,initial-scale=1,minimum-scale=1">
    <meta http-equiv=X-UA-Compatible content="ie=edge">
    <title>Login | Deergham</title>
    <meta name="description" content="Login | Deergham">
    <?php include "top-links.php" ?>
    
    <link rel=stylesheet href=css/contacts.min.css>
    <link rel=stylesheet href=css/custom.css>
</head>

<body>
    <?php include "header.php" ?>
   
    <main>
        <header class="page" style="padding-top:;">
        <div class="page_main container-fluid">
            <div class="container">
                <h1 class="page_header">Login</h1>
                <!--<p class="page_text">Nibh tellus molestie nunc non blandit. Mi tempus imperdiet nulla malesuada-->
                <!--    pellentesque elit</p>-->
            </div>
        </div>
        <div class="container">
            <ul class="page_breadcrumbs d-flex flex-wrap">
                <li class="page_breadcrumbs-item"><a class="link" href="<?php echo $wspath ?>">Home</a></li>
                <li class="page_breadcrumbs-item current"><span>Login</span></li>
            </ul>
        </div>
    </header>
        <div class="contacts section">
            <div class="container d-flex flex-wrap flex-xl-nowrap justify-content-between">
                <div class="col-lg-3"></div>
                <div class="contacts_form col-12 col-lg-6">
                    <div class="contacts_form-header">
                        <h2 class="contacts_form-header_title">Login Now</h2>
                        <!--<p class=contacts_form-header_text>Elementum eu facilisis sed odio morbi quis commodo odio.-->
                        <!--    Mauris rhoncus aenean vel elit scelerisque mauris pellentesque</p>-->
                    </div>
                    <form class="contacts_form-form d-flex flex-column" action="#" method="POST">
                    <!--<form class="contacts_form-form d-flex flex-column" action="verify.php" method="POST">-->
                        <label class="contacts_form-form_label" for="contactsName">Enter OTP</label>
                        <input class="contacts_form-form_field field required" type="tel" name="user_otp" placeholder="Enter Your OTP here">
                        
                        <!--<label class=contacts_form-form_label for="contactsEmail">Your Mobile</label> -->
                        <!--<input class="contacts_form-form_field field required" type="text" data-type="phone" name="contactsEmail" placeholder="Mobile Number">-->
                        
                        <button class="contacts_form-form_btn btn" type="submit" name="otp_submit">Submit OTP</button>
                        
                        <div class="log-text-btm">
                            <div class="not-mem"><p>Not A Member? <a href="register.html"><strong>Register Now.</strong></a></p></div>
                            <!--<div class="forget-pass"><a href=""><strong>Forget Password?</strong></a></div>-->
                        </div>
                    </form>
                </div>
                <div class="col-lg-3"></div>
            </div>
        </div>
    </main>
    
   <?php include "footer.php" ?>
   
</body>

</html>

MMCT - 2023