-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsignupaction.php
More file actions
executable file
·68 lines (66 loc) · 2.53 KB
/
signupaction.php
File metadata and controls
executable file
·68 lines (66 loc) · 2.53 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
<?php
require './mailer/class.phpmailer.php';
$mysqli = new mysqli('localhost', 'root', 'r', 'secure');
//$mysqli = new mysqli('localhost', 'mreuser1_mits', 'mits@123','mreuser1_healthvault');
if ($mysqli->connect_errno) {
echo "Sorry, this website is experiencing problems.";
echo "Error: Failed to make a MySQL connection, here is why: \n";
echo "Errno: " . $mysqli->connect_errno . "\n";
echo "Error: " . $mysqli->connect_error . "\n";
exit;
}
if(isset($_POST['submit']))
{
$email=$_POST['email'];
$password=$_POST['password'];
$status=0;
$activationcode=md5($email.time());
/*
var_dump($email);
var_dump($password);
var_dump($activationcode);
*/
$hashpassword = password_hash($password, PASSWORD_DEFAULT);
$query="insert into unverified_users(email,password,status,activationcode) values('$email','$hashpassword','$status','$activationcode')";
if (!$result = $mysqli->query($query)) {
echo "Sorry, the website is experiencing problems.";
echo "Error: Our query failed to execute and here is why: \n";
echo "Query: " . $query . "\n";
echo "Errno: " . $mysqli->errno . "\n";
echo "Error: " . $mysqli->error . "\n";
exit;
}
if($result)
{
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.freehosting.host';
$mail->SMTPAuth = true;
$mail->Username = 'mail@myhealthvault.tk';
$mail->Password = 'Mits1234';
//$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('mail@myhealthvault.tk','xxxxxxxx');
$mail->addReplyTo('mail@myhealthvault.tk', 'xxxxxxxx');
$mail->addAddress($email); // Add a recipient
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
$mail->isHTML(true); // Set email format to HTML
$bodyContent = "<html></body><div><div>Dear $name,</div></br></br>";
$bodyContent .= "<div style='padding-top:8px;'>Please click on the following link to verify and activate your xxxxxxxxxxx account</div>
<div style='padding-top:10px;'><a href='http://localhost:8080/secure/Data-Security/email_verification.php?code=$activationcode'>Click Here</a></div>
<div style='padding-top:4px;'><br><br>Powered by <a href='xxxxxxxx'>healthvault.com</a></div></div>
</body></html>";
$mail->Subject = 'Account verification for xxxxxxxxxxxxx';
$mail->Body = $bodyContent;
}
if(!$mail->send()) {
echo 'Verification code could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Verification link has been sent to your email id.';
}
}
$result->free();
$mysqli->close();
?>