process.php
3.29 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
require_once 'classes/realops.php';
$get = new Get()
$db = $get->connect();
if(isset($_POST['forgot']))
{
$selectPilot = $db->getRow("SELECT * FROM tbl_pilots WHERE vatsimID =?", array($_POST['vatsimID']));
if(!empty($selectPilot))
{
$messageBody = "You are receiving this email because you have requested your VATPAC Sunday Night Live Passcode. \n
Your passcode for VATPAC's RealOps is: " . $selectPilot['passcode'] . "\n
Please use this passcode to make future bookings and to view your flight dispatch on the night. \n \n
We are looking forward to your participation this year!\n \n
VATPAC Events Team.";
require_once 'swift/lib/swift_required.php';
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('mail.internode.on.net', 25);
/*
You could alternatively use a different transport such as Sendmail or Mail:
// Sendmail
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
// Mail
$transport = Swift_MailTransport::newInstance();
*/
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
// Create a message
$message = Swift_Message::newInstance('Your VATPAC RealOps Passcode')
->setFrom(array('[email protected]'))
->setTo(array($selectPilot['email']))
->setBody($messageBody)
;
// Send the message
$result = $mailer->send($message);
echo "1";
}
else
{
echo "2";
die();
}
}
else if(isset($_POST['email']))
{
if(!empty($_POST['vatsimID']) && !empty($_POST['email']) && !empty($_POST['passcode']))
{
$db->insertRow("INSERT INTO tbl_pilots (vatsimID, email, passcode) VALUES (?, ?, ?)", array($_POST['vatsimID'], $_POST['email'], $_POST['passcode']));
session_start();
$_SESSION['vatsimID'] = $_POST['vatsimID'];
$_SESSION['authenticated'] = 1;
$messageBody = "Your passcode for VATPAC's RealOps is: " . $_POST['passcode'] . "\n
Please use this passcode to make future bookings and to view your flight dispatch on the night. \n \n
We are looking forward to your participation this year!\n \n
VATPAC Events Team.";
require_once 'swift/lib/swift_required.php';
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('mail.internode.on.net', 25);
/*
You could alternatively use a different transport such as Sendmail or Mail:
// Sendmail
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
// Mail
$transport = Swift_MailTransport::newInstance();
*/
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
// Create a message
$message = Swift_Message::newInstance('Your VATPAC RealOps Passcode')
->setFrom(array('[email protected]'))
->setTo(array($_POST['email']))
->setBody($messageBody)
;
// Send the message
$result = $mailer->send($message);
if($result == 1)
header("Location: slots.php?success=" . $result);
}
else
{
header("Location: slots.php?success=0");
}
}
else if(!empty($_POST['vatsimID']) && !empty($_POST['passcode']))
{
$row =$db->getRow("SELECT * FROM tbl_pilots WHERE vatsimID =?", array($_POST['vatsimID']));
if(!empty($row))
{
if($_POST['passcode'] == $row['passcode'])
session_start();
$_SESSION['vatsimID'] = $_POST['vatsimID'];
$_SESSION['authenticated'] = 1;
echo "true";
}
else
{
}
}
?>