-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
96 lines (91 loc) · 2.89 KB
/
process.php
File metadata and controls
96 lines (91 loc) · 2.89 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
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet/reset.css">
<link rel="stylesheet" type="text/css" href="stylesheet/fonts/stylesheet.css">
<link rel="stylesheet" type="text/css" href="stylesheet/icons/style.css">
<link rel="stylesheet" type="text/css" href="stylesheet/register.css?version=2">
</script>
<meta charset="utf-8">
<title>User Registration</title>
</head>
<body>
<?php
require "header.inc.php";
?>
<div id="container">
<?php
if(isset($_POST['signup'])){
include('includes/dbconnect.inc.php');
try{
$sendTo=$_POST["email"];
$username=$_POST["username"];
$email=md5($_POST["email"]);
$password=md5($_POST["pswd"]);
$address=$_POST["address"];
$interest1=$_POST["inter"];
$interest2=$_POST["inter2"];
$gender=$_POST["gender"];
$age=$_POST["age"];
$photo=$_POST["photo"];
$accountStatus=0;
$hash = md5( rand(0,1000) );
$q=$checkDatabaseConnection->prepare("insert into reader_registration values(:username,:email,:password,:address,:interest1,:interest2,:gender,:age,:photo,:hash,:accountStatus)");
$q->bindParam(':username',$username);
$q->bindParam(':email',$email);
$q->bindParam(':password',$password);
$q->bindParam(':address',$address);
$q->bindParam(':interest1',$interest1);
$q->bindParam(':interest2',$interest2);
$q->bindParam(':gender',$gender);
$q->bindParam(':age',$age);
$q->bindParam(':photo',$photo);
$q->bindParam(':hash',$hash);
$q->bindParam(':accountStatus',$accountStatus);
$q->execute();
echo"<p id=\"sqlerror\">We have sent a Confirmation Link to your specified Email Address. Please click that Confirmation Link to Activate Your Account.</p>";
$to = $sendTo;
$subject = 'Signup | Verification';
$message = '
Thanks for signing up!
Your account has been created, you can login after you have activated your account by pressing the url below.
Please click this link to activate your account:
http://localhost/project/verify.php?email='.$sendTo.'&hash='.$hash.'
Sent to:
------------------------
Username: '.$username.'
Email: '.$sendTo.'
------------------------
If this Email is not supposed to be sent to you, then Please contact us at :
support@uaarbookstore.com
to get Unregistered.
';
$from = 'info@uaarbookstore.com';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465,'ssl')
->setUsername('ar27111994@gmail.com')
->setPassword(')%!$$@(%$)')
;
$mailer = Swift_Mailer::newInstance($transport);
$RegisterMail=Swift_Message::newInstance();
$RegisterMail->setSubject($subject);
$RegisterMail->setBody($message);
$RegisterMail->setFrom($from);
$RegisterMail->setTo($to);
$subscribed=$mailer->send($RegisterMail);
$checkDatabaseConnection=NULL;
}
catch(PDOException $e)
{
echo "Error: " . $e->getMessage();
}
}
else{
echo"<p id=\"sqlerror\">Invalid Approach.</p>";
}
?>
</div>
<?php
require 'footer.inc.php';
?>
</body>
</html>