-
Notifications
You must be signed in to change notification settings - Fork 0
/
register1.php
112 lines (80 loc) · 2.41 KB
/
register1.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
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
<?php
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$_email="";
$_password="";
$_image1="";
$_email=$_POST["email"];
$_password=$_POST["password"];
$target_dir="userimg/";
$target_file=$target_dir.basename($_FILES["txtimage"]["name"]);
echo $target_file;
if(move_uploaded_file($_FILES["txtimage"]["tmp_name"],$target_file))
{
echo 'file uploaded';
}
$_image1=$target_file;
$string=md5(rand());
$token=substr($string,0,10);
require 'class/loginclass.php';
$obj=new loginclass();
$_result=$obj->insert($_email,$_password,$_image1);
if($_result===true)
{
error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
require_once "phpmailer/class.phpmailer.php";
$message="localhost/bootstrapdemo/mattress/verify.php?token=".$token."&email=".$_email."";
// creating the phpmailer object
$mail = new PHPMailer(true);
// telling the class to use SMTP
$mail->IsSMTP();
// enables SMTP debug information (for testing) set 0 turn off debugging mode, 1 to show debug result
$mail->SMTPDebug = 0;
// enable SMTP authentication
$mail->SMTPAuth = true;
// sets the prefix to the server
$mail->SMTPSecure = 'ssl';
// sets GMAIL as the SMTP server
$mail->Host = 'smtp.gmail.com';
// set the SMTP port for the GMAIL server
$mail->Port = 465;
// your gmail address
$mail->Username = '[email protected]';
// your password must be enclosed in single quotes
$mail->Password = 'maildemo1234';
// add a subject line
$mail->Subject = ' verification ';
// Sender email address and name
$mail->SetFrom('[email protected]', 'verification account link');
$email1=$_email;
// reciever address, person you want to send
$mail->AddAddress($email1);
// if your send to multiple person add this line again
//$mail->AddAddress('[email protected]');
// if you want to send a carbon copy
//$mail->AddCC('[email protected]');
// if you want to send a blind carbon copy
//$mail->AddBCC('[email protected]');
// add message body
$mail->MsgHTML($message);
// add attachment if any
//$mail->AddAttachment('time.png');
try {
// send mail
//don't forget to enable openssl true from php_extensions
$mail->Send();
$msg = 'Mail send successfully please verify your account <a href="mail.gmail.com">click me to verify</a>';
} catch (phpmailerException $e) {
$msg = $e->getMessage();
} catch (Exception $e) {
$msg = $e->getMessage();
}
echo $msg;
// header('location:login.php');
}
else
{
echo "Not Successfull";
}
}
?>