Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/member/
Upload File :
Current File : /home2/wtmwscom/public_html/member/otp.php

<?php
$title = "OTP Authentication";
include 'header.php';
require "../lib/PHPMailer-master/PHPMailerAutoload.php"; 
//include_once('lib/ps_pagination.php');
$uid = $_SESSION['userid'];
if(!isset($_SESSION['otp_redirect'])){
    redirect("index.php");
    die;
}
if (!isset($_SESSION['otp'])) {
    //echo "Please wait we are processing your request...";
    $otp = mt_rand(1000, 9999);
    //$is_insert = mysqli_query($connection,"");
    //if ($is_insert) {
    $_SESSION['otp'] = $otp;
    $_SESSION['otp_auth'] = FALSE;
    //}
    $message = "<h3>Ad Bazaar OTP </h3> "
            . '<h1 style="color: green;font-size: 40px;">'.$otp.'</h1>'
            . "<br/><br/><br/><br/><p>Regards, </p><p>Ad Bazaar Team</p>";
    send_phpmailer_mail($_SESSION['email'], "Ad Bazaar OTP ", $message);
    setMessage('An email has been sent to your registered email id. Please get OTP from email and enter here.', 'alert-msg success');
    //redirect("./outbox.php");
} else {
    setMessage('An email has been already sent earlier to your registered email id. Please get OTP from email and enter here.', 'alert-msg success');
}
if(isset($_POST['submit'])) {
    //$db_otp = mysqli_query($connection,"SELECT otp FROM `user` WHERE uid = '$uid'");
    if(tres($_POST['otp']) == $_SESSION['otp']) {
        $_SESSION['otp_auth'] = TRUE;
        $otp_redirect = $_SESSION['otp_redirect'];
        unset($_SESSION['otp']);
        unset($_SESSION['otp_redirect']);
        setMessage('OTP authenticated. Please continue now.', 'alert-msg success');
        redirect($otp_redirect);
        die;
    } else {
        setMessage("Incorrect OTP try again!", 'alert-msg error');
    }

}
?>

<?php echo getMessage(); ?>
<h1>Enter OTP here</h1>
<section>
    <form name="" id="" action="" method="post" class="form-horizontal">
        <div class="row"> 
            <div class="col-md-8">
                <div class="form-group">
                    <label for="otp">OTP <span>*</span></label>
                    <input type="password" name="otp" class="form-control" id="otp" value="" required="required" />
                </div>
                <input  name="submit"  type="submit" id="submit" value="Submit" class="btn btn-primary">

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

<?php include 'footer.php'; ?>