-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendmails.php
More file actions
36 lines (36 loc) · 1.21 KB
/
sendmails.php
File metadata and controls
36 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<script src="sweetalert.js"></script>
<body>
<?php
$email=$_GET['email'];
//echo $email;
$otp=rand(1000,9999);
$otp1 = $otp;
$ciphering = "AES-128-CTR";
$iv_length = openssl_cipher_iv_length($ciphering);
$options = 0;
$encryption_iv = '1234567891011121';
$encryption_key = "encryptdecrypt";
$onetime = openssl_encrypt($otp1, $ciphering,
$encryption_key, $options, $encryption_iv);
$onetime=base64_encode($onetime);
$to_email = $email;
$subject = "CAMPUS TRAINEE LOGIN";
$body = "Your one time password is ".$otp;
$headers = "From: rajath2322@gmail.com";
if (mail($to_email, $subject, $body, $headers)) {
//echo "<script>alert('otp has been sent');</script>";
//echo '<script>window.location.href="verifyotp.php?email='.$email.'&onetime='.$onetime.'"</script>';
}
echo"<script>Swal.fire({
icon: 'success',
title: 'OTP has been sent',
showConfirmButton: false,
timer: 2000
}).then((result) => { window.location.href='verifyotp.php?email=".$email."&onetime=".$onetime."'})</script>";
?>
</body>
</html>