blob: 65b50184178b6b239f92f04ecc516c817b810ff2 (
plain)
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
|
<?php
class User_depricated
{
/** PROPERTIES
* -------------------------------------------------------------------------
*/
private $isLogged = false;
private $who = Array(
'title' => '',
'name' => '',
'middle'=> '',
'surname' =>'',
'email' => ''
);
private $addresses = Array();
/** METHODS
* -------------------------------------------------------------------------
*/
public function create()
{
}
public function setDefaultAddress($id)
{
}
public function addAddress()
{
// update session data
// update user record
}
public function changePassword()
{
}
public function confirmEmail()
{
}
public function sendEmail()
{
}
/** sendOTP()
* sent One-Time-Password
*
*/
public function sendOTP($ttl)
{
$to = $this->who;
$otp = rand(10000,99999);
$expire = time() + $ttl;
$mail = new PHPMailer(true);
try {
//Server settings
// ...
//Recipients
$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress($to['email'], $to['surname'] .' '. $to['name']); //Add a recipient
$mail->addReplyTo('info@example.com', 'Information');
//Attachments
$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Your OTP';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
/** updateSession()
* regenerates session
*/
public function updateSession()
{
}
}
|