-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewregistration.php
More file actions
89 lines (87 loc) · 2.21 KB
/
newregistration.php
File metadata and controls
89 lines (87 loc) · 2.21 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
<?php
session_start();
$host="localhost";
$user="root";
$password="";
$db="simplilearn";
$conn=mysqli_connect("$host","$user","$password","$db");
if($conn)
{
$sql="SELECT * from registration";
$retval=mysqli_query($conn,$sql);
$user=$_POST['user'];
$firstname=$_POST['first'];
$lastname=$_POST['last'];
$password=$_POST['password'];
$confirm=$_POST['confirmpassword'];
$gender=$_POST['gender'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$birthdate='-';
$h=false;
if($confirm!=$password)
{
$_SESSION['error']="Enter password correctly";
header("location:signup.php");
}
else
{
while ($row=mysqli_fetch_assoc($retval))
{
if($row['username']==$user or $row['email']==$email)
{
$h=true;
}
}
if($h==true)
{
$_SESSION['error']="Username or email already exits";
header("location:signup.php");
}
else
{
$sql="INSERT into registration values('$lastname','$password','$gender','$email','$phone','$address','$city','$user',
'$firstname','$birthdate','$state')";
$retval=mysqli_query($conn,$sql);
$sql="INSERT into login values('$user','$password')";
$retval=mysqli_query($conn,$sql);
$sql="INSERT into education values('$user','$birthdate','$birthdate','$birthdate','$birthdate')";
$retval=mysqli_query($conn,$sql);
if($retval)
{
$_SESSION['error']="Successfully registered";
}
else
{
echo "Error";
}
require_once('PHPMailer/PHPMailerAutoload.php');
$from='rakeshkatakam58@gmail.com';
$to=$email;
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = '465';
$mail->isHTML();
$mail->Username = $from;
$mail->Password = 'raki1999';
$mail->Subject = 'Simplilearn';
$mail->Body = 'You have Successfully registered to our Simplilearn website.for Any further updates stay tuned on our website.Thanks ...';
$mail->AddAddress($to);
if($mail->Send())
{
header("location:newproject.php");
}
else
{
echo "error in sending";
}
}
}
}
?>