-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemailpasswordupdate.php
More file actions
44 lines (43 loc) · 1.12 KB
/
emailpasswordupdate.php
File metadata and controls
44 lines (43 loc) · 1.12 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
<?php
session_start();
$host="localhost";
$user="root";
$password="";
$db="simplilearn";
$conn=mysqli_connect("$host","$user","$password","$db");
if($conn)
{
$email=$_POST['email'];
$sql="SELECT * from registration where email='$email' ";
$retval=mysqli_query($conn,$sql);
if($retval)
{
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 = '<p>Click The below link To update your password</p><a href="http://localhost/passwordupdatelink.php">Update Password</a>';
$mail->AddAddress($to);
if($mail->Send())
{
$_SESSION['p23']='Update password link Sent to your email';
$_SESSION['email']=$email;
header("location:newproject.php");
}
}
else
{
$_SESSION['error']="Invalid email address";
header("location:forgotpassword.php");
}
}
?>