
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once 'admin/includes/settings/PDODB.php';
include 'admin/includes/modules/functions.php';
$function = new FUNCTIONS();
if(isset($_POST['sendLogin'])){
$username = !empty($_POST['username'])?trim($_POST['username']):"";
$email = !empty($_POST['email'])?trim($_POST['email']):"";
$mobile = !empty($_POST['mobile'])?trim($_POST['mobile']):"";;
//print_r($_POST); //exit;
if(!empty($username) && !empty($email) && !empty($mobile)){
$loginQuery = "SELECT * FROM `users` WHERE email='$email' AND isactive='1'";
$pdodb = PDODB::getInstance();
$result = $pdodb->query($loginQuery);
PDODB::closeInstance();
$otp = rand(100000, 999999);
if(!empty(count($result))){
//echo "login user"; //exit;
$_SESSION['email'] = $email;
$_SESSION['userId'] = $result[0]['id'];
$_SESSION['otp'] = $otp;
$to = $result[0]['email'];
$subject = "OTP to verification code";
$messagebody='<table cellpadding="0" cellspacing="0" style="width:600px; margin:0px auto; color:#7b7b7c; vertical-align:middle; font-family:Arial, Helvetica, sans-serif; font-size:16px;">
<tr>
<td style="text-align:center;"><a href="#"><img src="" /></a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td style="color:#333;"><strong>Hi,</strong></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>OTP to login to your account</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" style="width:600px; margin:0px auto; color:#7b7b7c; vertical-align:top; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:22px;">
<tr>
<td> </td>
</tr>
<td> </td>
</tr>
<tr>
<td width="200px;">Otp</td>
<td width="20px;">:</td>
<td width="380px;">'.$otp.'</td>
</tr>
</table>';
$mailSent = $function->sendMail($to=$to,$subject=$subject,$messagebody=$messagebody);
$usern = $result[0]['username'];
$message = 'Dear '.$usern.', Your OTP for completing the registering the process is '.$otp.' VINBOX';
//$smsSent = $function->sendSms($result[0]['mobile'], $message);
if($mailSent== true) {
header("Location: https://artemis.jiffyfilms.com/otp-verify.php");
exit();
//echo "<script>window.location.href='otp-verify.php';</script>";
}else {
$error_msg = "mail not sent";
}
}else{
//Alert
// echo "register user"; //exit;
$pdodb = PDODB::getInstance();
$sql = "INSERT INTO `users` SET username='$username', mobile='$mobile', email='$email'";
$result = $pdodb->query($sql);
$insert_user = $pdodb->lastInsertId();
$_SESSION['email'] = $email;
$_SESSION['otp'] = $otp;
$_SESSION['userId'] = $insert_user;
$to = $email;
$subject = "OTP to verification code";
$messagebody='<table cellpadding="0" cellspacing="0" style="width:600px; margin:0px auto; color:#7b7b7c; vertical-align:middle; font-family:Arial, Helvetica, sans-serif; font-size:16px;">
<tr>
<td style="text-align:center;"><a href="#"><img src="" /></a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td style="color:#333;"><strong>Hi,</strong></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>OTP to login to your account</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" style="width:600px; margin:0px auto; color:#7b7b7c; vertical-align:top; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:22px;">
<tr>
<td> </td>
</tr>
<td> </td>
</tr>
<tr>
<td width="200px;">Otp</td>
<td width="20px;">:</td>
<td width="380px;">'.$otp.'</td>
</tr>
</table>';
$mailSent = $function->sendMail($to=$to,$subject=$subject,$messagebody=$messagebody);
$usern = $username;
$message = 'Dear '.$usern.', Your OTP for completing the registering the process is '.$otp.' VINBOX';
// $smsSent = $function->sendSms($mobile, $message);
if($mailSent== true) {
header("Location: https://artemis.jiffyfilms.com/otp-verify.php");
exit();
//echo "<script>window.location.href='otp-verify.php';</script>";
}else {
$error_msg = "mail not sent";
}
}
}else{
//Alert
$error_msg = "Kindly enter your Name, email and mobile number.";
//echo "<script>tossterMsgAlert('".$error_msg."','Error');</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>ARTEMIS Hospitals Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='css/bootstrap.min.css'>
<link rel='stylesheet' href='css/style.css'>
<link href="images/favicon.ico" rel="shortcut icon" type="image/png">
<style type="text/css">
body {
background: url('images/bg.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.error {
color: red;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<!-- Follow these instructions, please! -->
<div class="container py-5">
<div class="row justify-content-center">
<div class="col-md-6 col-10 loginform">
<div class="row justify-content-center">
<div class="col-4">
<img src="images/logo.png" class="img-fluid">
</div>
<!-- <h3 class="text-center">ARTEMIS Hospitals</h3> -->
</div>
<br>
<form action="" method="POST" id="loginForm">
<div class="mb-3">
<!-- <div class="form-group">
<input type="text" class="form-control" name="username" id="username" placeholder="Name">
</div>
<div class="form-group">
<input type="text" class="form-control" name="email" id="email" placeholder="Email ID">
</div> -->
<input type="text" class="form-control mb-3" id="username" name="username" placeholder="Name">
<input type="email" class="form-control mb-3" id="email" name="email" placeholder="Email ID">
<input type="number" class="form-control" id="mobile" name="mobile" placeholder="Mobile Number">
</div>
<p>Note: <small>OTP will be sent on email address</small></p>
<p style="color:red; text-align: center;"><?=(!empty($error_msg))?$error_msg:'';?></p>
<button type="submit" class="btn login-btn" name="sendLogin" id="sendLogin">Send Otp</button>
</form>
</div>
</div>
</div>
<!-- partial -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="assets/js/jquery.form-validator.min.js"></script>
<script src='js/bootstrap.bundle.min.js'></script>
<script type="text/javascript">
$("#loginForm").validate({
rules: {
username: {
required: true
},
mobile: {
required: true,
minlength: 10,
maxlength: 10,
//number: true
digits: true
},
email: {
required: true,
email: true/*,
emailValidate: true*/
}
},
messages: {
username: {
required: "Please enter your name"
},
mobile: {
required: "Please enter mobile No",
minlength: "Mobile No Must Contain at least 10 digit",
maxlength: "Mobile No Must Not Exceed 10 digit",
digits: "Please enter only digit"
},
email: {
required: "Please enter email address",
email: "Please enter valid email"
},
},
submitHandler: function(form) {
$(form).find('button[type="submit"]').prop('disabled', true);
$(form).find('button[type="submit"]').text('Please wait..', true);
form.submit();
}
});
</script>
</body>
</html>


PK 99