-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchangeinfo.php
133 lines (130 loc) · 7.1 KB
/
changeinfo.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
if(!isset($_SESSION)){ session_start(); }
date_default_timezone_set('Asia/Calcutta');
include_once 'connection.php';
include_once ('functions.php');
require("PHPMailer/class.phpmailer.php");
if(isset($_POST['address'])&&isset($_POST['city'])&&isset($_POST['state'])&&isset($_POST['pincode'])&&isset($_POST['mobile'])&&isset($_SESSION['login'])&&$_SESSION['login'])
{
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$pin=$_POST['pincode'];
$mobile=$_POST['mobile'];
if(preg_match("/^[a-zA-Z0-9-#.!,@\[\]\(\)\/ ]+$/", $address)&&preg_match("/^[a-zA-Z-& ]+$/", $city)&&preg_match("/^[a-zA-Z-& ]+$/", $state)&&preg_match("/^[0-9]{6}$/", $pin)&&preg_match("/^[0-9]{10}$/", $mobile))
{
$sql="UPDATE customer SET CustAddress='$address', CustCity='$city', CustState='$state', CustMobile='$mobile', CustPostalCode='$pin' WHERE CustomerID=".$_SESSION['CustomerID'];
//echo $sql;
$query=mysql_query($sql);
}
#----------------------------------------------------------------------------------------------------------------
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.golfessentials.in"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPKeepAlive = true;
$mail->Mailer = "smtp";
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "Ie9rDuWAEDQ]"; // SMTP password
$mail->From = "[email protected]";
$mail->FromName = "golfessentials.in";
$mail->AddAddress(GetCustomerDetails('email')); // name is optional
$mail->AddReplyTo("[email protected]");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Your account information has been changed";
ob_start();
include 'mail/changeinfo.php';
$content = ob_get_clean();
$mail->Body = $content;
$mail->AltBody = $content;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
$_SESSION['pi']=TRUE;
#----------------------------------------------------------------------------------------------------------------
}
elseif (isset($_POST['repeatpwd'])) {
$newpwd=$_POST['repeatpwd'];
function unique_salt() { return substr(sha1(mt_rand()),0,22); }
$salt= unique_salt();
$h_pwd= crypt($newpwd, '$2a$10$'.$salt);
$sql="UPDATE customer SET CustPassword='$h_pwd' WHERE CustomerID=".$_SESSION['CustomerID'];
$query=mysql_query($sql);
#----------------------------------------------------------------------------------------------------------------
$mail = new PHPMailer(true);
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.golfessentials.in"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPKeepAlive = true;
$mail->Mailer = "smtp";
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "Ie9rDuWAEDQ]"; // SMTP password
$mail->From = "[email protected]";
$mail->FromName = "golfessentials.in";
$mail->AddAddress(GetCustomerDetails('email')); // name is optional
$mail->AddReplyTo("[email protected]");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Your account information has been changed";
ob_start();
include 'mail/changeinfo.php';
$content = ob_get_clean();
$mail->Body = $content;
$mail->AltBody = $content;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
$_SESSION['p']=TRUE;
#----------------------------------------------------------------------------------------------------------------
} elseif (isset($_POST['repeatemail'])) {
$newemail=$_POST['repeatemail'];
$sql="UPDATE customer SET CustEmail='$newemail' WHERE CustomerID=".$_SESSION['CustomerID'];
$query=mysql_query($sql);
#----------------------------------------------------------------------------------------------------------------
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.golfessentials.in"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPKeepAlive = true;
$mail->Mailer = "smtp";
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "Ie9rDuWAEDQ]"; // SMTP password
$mail->From = "[email protected]";
$mail->FromName = "golfessentials.in";
$mail->AddAddress($newemail); // name is optional
$mail->AddReplyTo("[email protected]");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Your account information has been changed";
ob_start();
include 'mail/changeinfo.php';
$content = ob_get_clean();
$mail->Body = $content;
$mail->AltBody = $content;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
$_SESSION['e']=TRUE;
#----------------------------------------------------------------------------------------------------------------
}
header('Location: register');
?>