-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathzonedetails.php
More file actions
91 lines (83 loc) · 2.79 KB
/
zonedetails.php
File metadata and controls
91 lines (83 loc) · 2.79 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
90
91
<HTML>
<HEAD>
<TITLE>Domain details</TITLE>
<LINK rel="stylesheet" href="style.css" type="text/css">
</HEAD>
<BODY bgcolor="#cccc99" background="images/BG-shadowleft.gif">
<?php
require('inc/lib.inc');
function update_description($domain, $descrip, $options)
{
$db = new DB_probind;
if (strlen($options) > 254) {
print "<FONT color=RED size=+2>Too much options; maximum options length is 255 symbols</FONT><BR>\n";
return;
}
$db->prepare("SELECT id FROM zones WHERE domain = ?");
$db->execute($domain);
if ($db->next_record()) $zone=$db->Record;
else die("No such domain: $domain<P>\n");
$id = $zone['id'];
$db->prepare("DELETE FROM annotations WHERE zone = ?");
$db->execute($id);
$db->prepare("INSERT INTO annotations (zone, descr) VALUES (?, ?)");
$db->execute($id,$descrip);
$options = strtr($options, "'",'"');
$db->prepare("UPDATE zones SET options=?, updated=1 WHERE id=?");
$db->execute($options,$id);
}
function domain_details($domain)
{
$db = new DB_probind;
$db->prepare("SELECT id, mtime, ctime, options FROM zones WHERE domain = ?");
$db->execute($domain);
if ($db->next_record()) $zone=$db->Record;
else die("No such domain: $domain<P>\n");
$mtime = $zone['mtime'];
$ctime = $zone['ctime'];
$id = $zone['id'];
$options = htmlspecialchars($zone['options']);
$result = "<H1>$domain</H1>\n";
$result .= "<FORM action=\"zonedetails.php\" method=\"post\">\n";
$result .= "<TABLE width=\"100%\" border><TR align=left><TH>Zone created in database</TH><TH>Last update in database</TH></TR>
<TR><TD>$ctime</TD><TD>$mtime</TD></TR>
<TR><TD colspan=2 align=CENTER>Zone options (<b>no syntax check here!</b>):<HR> <TEXTAREA rows=10 cols=60 name=\"options\">$options</TEXTAREA></TD></TR>
<TR><TD colspan=2 align=CENTER>When you create or modify a domain, please add a note to the domain
description. The note should contain the date, your initials and a few
words about what was done (and perhaps why). Please add new entries
at the top.
<HR>
";
$db->prepare("SELECT descr from annotations WHERE zone = ?");
$db->execute($id);
$result .= "
<INPUT type=\"hidden\" name=\"action\" value=\"textupdate\">
<INPUT type=\"hidden\" name=\"domain\" value=\"$domain\">
<TEXTAREA name=\"description\" rows=10 cols=60>\n";
if ($db->next_record())
$result .= $db->Record['descr'];
$result .= "</TEXTAREA>
</TR><TR>
<TD><INPUT type=reset></TD>
<TD><INPUT type=submit name=submit value=Update></TD>
</TR></TABLE>
</FORM>
";
return $result;
}
#
# MAIN
#
get_input();
if ($domain = $INPUT_VARS['domain']) {
if (isset($INPUT_VARS['action']) && ($INPUT_VARS['action'] == "textupdate")) {
update_description($INPUT_VARS['domain'],
htmlspecialchars($INPUT_VARS['description']), $INPUT_VARS['options']);
}
print domain_details($domain);
} else {
print "No domain specified.<P>$QUERY_STRING<P>\n";
}
?>
</BODY>
</HTML>