-
Notifications
You must be signed in to change notification settings - Fork 0
/
InvitationTable.php
66 lines (43 loc) · 1.82 KB
/
InvitationTable.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
58
59
60
61
62
63
64
65
66
<?php
session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = $_POST["email"];
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "Kanban_Board";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_SESSION['rfemail'])) {
$rfemail = $_SESSION['rfemail'];
}
// $referenceCode = generateReferenceCode();
// Insert data into database
$sql = "INSERT INTO invitemeberinfo (User_Email,Invited_Member_Email)
VALUES ('$rfemail','$email')";
if ($conn->query($sql) === TRUE) {
// Send verification email
sendInvitationEmail($email,$rfemail,$conn);
exit;
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
function sendInvitationEmail($to, $rfemail,$conn) {
$subject = "Invitation for join IIT Kanban Board.";
$message = "Please Creat Account For Join to IIT Kanban Board for manage your Software Project Lab(SPL).\n";
$message .= "Reference mail: $rfemail";
$headers = "From: ij.jhumu.nstu@gmail.com"; //
if(mail($to, $subject, $message, $headers)){
$_SESSION['success'] = "Invitation Successful.";
header("Location: invite_member.php");
}else{
$_SESSION['success'] = "Invitation failed.";
header("Location: invite_member.php");
}
}
?>