63a0529b21bfd97a4ef395e8d3d3f513526357c6
bernd Stub für dns-Admin-Interface

bernd authored 15 years ago

1) <?php
2) 
3) require_once('inc/debug.php');
4) require_once('inc/db_connect.php');
5) require_once('inc/base.php');
6) require_once('inc/security.php');
7) 
8) require_once('class/domain.php');
9) 
10) 
11) function get_dyndns_accounts() 
12) {
13)   $uid = (int) $_SESSION['userinfo']['uid'];
14)   $result = db_query("SELECT * FROM dns.dyndns WHERE uid={$uid}");
15)   $list = array();
16)   while ($item = mysql_fetch_assoc($result)) {
17)     array_push($list, $item);
18)   }
19)   DEBUG($list);
20)   return $list;
21) }
22) 
23) 
24) function get_dyndns_account($id) 
25) {
26)   $id = (int) $id;
27)   $uid = (int) $_SESSION['userinfo']['uid'];
28)   $result = db_query("SELECT * FROM dns.dyndns WHERE id={$id} AND uid={$uid}");
29)   if (mysql_num_rows($result) != 1) {
bernd eliminate .php extensions f...

bernd authored 15 years ago

30)     logger("modules/dns/include/dnsinclude", "dyndns", "account »{$id}« invalid for uid »{$uid}«.");
bernd Stub für dns-Admin-Interface

bernd authored 15 years ago

31)     system_failure("Account ungültig");
32)   }
33)   $item = mysql_fetch_assoc($result);
34)   DEBUG($item);
35)   return $item;
36) }
37) 
38) 
39) function create_dyndns_account($handle, $password_http, $sshkey)
40) {
41)   $uid = (int) $_SESSION['userinfo']['uid'];
42)   $handle = maybe_null(mysql_real_escape_string(filter_input_username($handle)));
43)   $sshkey = maybe_null(mysql_real_escape_string(filter_input_general($sshkey)));
44) 
45)   $pwhash = 'NULL';
46)   if ($password_http)
47)     $pwhash = "'{SHA}".base64_encode(sha1($password_http, true))."'";
48) 
49)   db_query("INSERT INTO dns.dyndns (uid, handle, password, sshkey) VALUES ({$uid}, {$handle}, {$pwhash}, {$sshkey})");
bernd eliminate .php extensions f...

bernd authored 15 years ago

50)   logger("modules/dns/include/dnsinclude", "dyndns", "inserted account");
bernd Stub für dns-Admin-Interface

bernd authored 15 years ago

51) }
52) 
53) 
54) function edit_dyndns_account($id, $handle, $password_http, $sshkey)
55) {
56)   $id = (int) $id;
57)   $handle = maybe_null(mysql_real_escape_string(filter_input_username($handle)));
58)   $sshkey = maybe_null(mysql_real_escape_string(filter_input_general($sshkey)));
59) 
60)   $pwhash = 'NULL';
61)   if ($password_http)
62)     $pwhash = "'{SHA}".base64_encode(sha1($password_http, true))."'";
63) 
64)   db_query("UPDATE dns.dyndns SET handle={$handle}, password={$pwhash}, sshkey={$sshkey} WHERE id={$id} LIMIT 1");
bernd eliminate .php extensions f...

bernd authored 15 years ago

65)   logger("modules/dns/include/dnsinclude", "dyndns", "edited account »{$id}«");
bernd Stub für dns-Admin-Interface

bernd authored 15 years ago

66) }
67) 
68) 
69) function delete_dyndns_account($id)
70) {
71)   $id = (int) $id;
72) 
73)   db_query("DELETE FROM dns.dyndns WHERE id={$id} LIMIT 1");
bernd eliminate .php extensions f...

bernd authored 15 years ago

74)   logger("modules/dns/include/dnsinclude", "dyndns", "deleted account »{$id}«");