-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_invite.php
57 lines (45 loc) · 1.45 KB
/
send_invite.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require "Database.php";
require "mail/SMTP.php";
require "mail/PHPMailer.php";
require "mail/Exception.php";
use PHPMailer\PHPMailer\PHPMailer;
$un = $_POST["un"];
$pwd = $_POST["pwd"];
$email = $_POST["email"];
if(empty($un)){
echo("enter username");
}else if(empty($pwd)){
echo("enter password");
}else if(empty($email)){
echo("enter email");
}else{
$rs = Database::search("SELECT * FROM `academic` WHERE `email`='" . $email . "'");
$n = $rs->num_rows;
if ($n > 0) {
echo ("user alresy exist");
} else {
Database::iud("INSERT INTO `academic` (`username`,`pwd`,`email`) VALUES ('".$un ."', '".$pwd ."', '" .$email ."')");
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'sandyweboo@gmail.com';
$mail->Password = 'smbzhggpppdakkmf';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->setFrom('sandyweboo@gmail.com', 'Reset Password');
$mail->addReplyTo('sandyweboo@gmail.com', 'Reset Password');
$mail->addAddress($email);
$mail->isHTML(true);
$mail->Subject = '<h3 style="color:blue">Sandy learn</h3> Teacher login verification';
$bodyContent = '<h1 style="color:green">Your Verification username is '.$un.' </br> '.$pwd.' </br> </h1>';
$mail->Body = $bodyContent;
if (!$mail->send()) {
echo 'Verification code sending failed';
} else {
echo 'Success';
}
}
}
?>