forked from web-cyradm/web-cyradm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newemail.php
135 lines (120 loc) · 3.45 KB
/
newemail.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
134
<?php
if (!defined('WC_BASE')) define('WC_BASE', dirname(__FILE__));
$ref=WC_BASE."/index.php";
if ($ref!=$_SERVER['SCRIPT_FILENAME']){
header("Location: index.php");
exit();
}
?>
<!-- #################### newemail.php start #################### -->
<tr>
<td width="10"> </td>
<td valign="top">
<?php
if ($authorized) {
$query = "SELECT freeaddress FROM domain WHERE domain_name='".$_GET['domain']."'";
$result = $handle->query($query);
if (DB::isError($result)) {
die (_("Database error (newemail 19)"));
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC, 0);
$freeaddress=$row['freeaddress'];
if (!empty($_GET['confirmed']) && empty($_GET['cancel'])) {
if ($freeaddress != "YES") {
$query = "INSERT INTO `virtual` (alias,dest,username) VALUES ('".$_GET['alias']."@".$_GET['domain']."','".$_GET['dest']."','".$_GET['username']."')";
} else {
$query = "INSERT INTO `virtual` (alias,dest,username) VALUES ('".$_GET['alias']."@".$_GET['aliasdomain']."','".$_GET['dest']."','".$_GET['username']."')";
}
$result = $handle->query($query);
if (!DB::isError($result)) {
?>
<h3>
<?php print _("Successfully added");?>:
<span style="color: red;">
<?php echo $_GET['alias'];?>
</span>
</h3>
<?php
include WC_BASE . "/editaccount.php";
} else {
?>
<h3>
<?php print _("Database error (newemail 45), please try again");?>
</h3>
<?php
include WC_BASE . "/editaccount.php";
}
} elseif (!empty($_GET['cancel'])) {
include WC_BASE . "/editaccount.php";
} else {
?>
<h3>
<?php print _("New emailadress for user");?>:
<span style="color: red;">
<?php echo $_GET['username'];?>
</span>
</h3>
<form action="index.php" method="get">
<input type="hidden" name="action"
value="newemail">
<input type="hidden" name="confirmed"
value="true">
<input type="hidden" name="domain"
value="<?php print $_GET['domain'] ?>">
<input type="hidden" name="username"
value="<?php print $_GET['username'] ?>">
<table>
<tr>
<td>
<?php print _("Emailadress");?>
</td>
<td>
<input class="inputfield" type="text"
size="30" name="alias">
<?php
if ($freeaddress != "YES") {
print "@".$_GET['domain'];
} else {
print "@";
?>
<input class="inputfield" type="text"
size="20" name="aliasdomain">
<?php
}
?>
</td>
</tr>
<tr>
<td width="150">
<?php print _("Destination");?>
</td>
<td>
<input class="inputfield" type="text"
size="30" name="dest"
value="<?php print $_GET['username'];?>">
</td>
</tr>
<tr>
<td>
<input class="button" type="submit"
value="<?php print _("Submit");?>">
<input class="button" type="submit"
name="cancel" value="<?php print _("Cancel"); ?>">
</td>
</tr>
</table>
</form>
<?php
} // End of if (!empty($_GET['confirmed']))
} else { // if ($authorized)
?>
<h3>
<?php echo $err_msg;?>
</h3>
<a href="index.php?action=editaccount&domain=<?php echo $_GET['domain'];?>&username=<?php echo $_GET['username'];?>"><?php print _("Back");?></a>
<?php
}
?>
</td>
</tr>
<!-- #################### newemail.php end #################### -->