-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailsetting.php
104 lines (97 loc) · 3.94 KB
/
mailsetting.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
<?php
include("header.php");
if (isset($_POST["submit"])) {
//Insert Statement starts here
$smtp['mailsender'] = $_POST["mailsender"];
$smtp['smtpserver'] = $_POST["smtpserver"];
$smtp['smtpport'] = $_POST["smtpport"];
$smtp['loginid'] = $_POST["loginid"];
$smtp['password'] = $_POST["password"];
$smtp['smtpdetails'] = serialize($smtp);
$sqldel = "DELETE from mail_setting where settingtype='SMTP'";
$qsqldel = mysqli_query($con, $sqldel);
$sql = "INSERT INTO mail_setting (settingtype,settingdetails,status) VALUES('SMTP','$smtp[smtpdetails]','Active')";
$qsql = mysqli_query($con, $sql);
if (mysqli_affected_rows($con) == 1) {
echo "<script>alert('SMTP Setting Record done successfully..');</script>";
echo "<script>window.location='mailsetting.php';</script>";
} else {
$errmsg = str_replace("'", "", mysqli_error($con));
echo "<script>alert('$errmsg');</script>";
}
//Insert Statement ends here
}
?>
<?php
$sqledit = "SELECT * FROM mail_setting where settingtype='SMTP'";
$qsqledit = mysqli_query($con, $sqledit);
echo mysqli_error($con);
$rsedit = mysqli_fetch_array($qsqledit);
$smtpdetails = unserialize($rsedit['settingdetails']);
?>
<section class="ftco-section bg-light" style="padding-top: 15px;">
<div class="container">
<div class="row">
<div class="col-md-12 ftco-animate">
<div class="job-post-item bg-white p-4 d-block align-items-center">
<div class="mb-4 mb-md-1 mr-12">
<div class="job-post-item-header d-flex align-items-center">
<h2 class="mr-3 text-black h3">Settings</h2>
<div class="page-title-subheading">Add/Edit SMTP Setting details..
</div>
</div>
<div class="tab-content">
<div>
<div class="main-card mb-3 card">
<div class="card-body">
<form method="post" onsubmit="return validatesubmit()" action="">
<div class="form-row">
<div class="col-md-12">
<div class="position-relative form-group">
<label for="exampleCity" class="">Mail Sender</label>
<input name="mailsender" id="mailsender" type="text" class="form-control" value="<?php echo $smtpdetails['mailsender']; ?>">
</div>
</div>
<div class="col-md-12">
<div class="position-relative form-group">
<label for="exampleCity" class="">SMTP Server</label>
<input name="smtpserver" id="smtpserver" type="text" class="form-control" value="<?php echo $smtpdetails['smtpserver']; ?>">
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-12">
<div class="position-relative form-group">
<label for="exampleCity" class="">SMTP Port</label>
<input name="smtpport" id="smtpport" type="text" class="form-control" value="<?php echo $smtpdetails['smtpport']; ?>">
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-12">
<div class="position-relative form-group">
<label for="exampleCity" class="">Login ID</label>
<input name="loginid" id="loginid" type="text" class="form-control" value="<?php echo $smtpdetails['loginid']; ?>">
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-12">
<div class="position-relative form-group">
<label for="exampleCity" class="">Password</label>
<input name="password" id="password" type="password" class="form-control" value="<?php echo $smtpdetails['password']; ?>">
</div>
</div>
</div>
<div class="col-md-12">
</div>
<center><button class="mt-2 btn btn-primary" name="submit" type="submit">Update Settings</button></center>
</form>
</div>
</div><!-- end -->
</div>
</div>
</section>
<?php
include("footer.php");
?>