Neues Modul zum Prüfen der...
Bernd Wurst authored 10 years ago
|
1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4)
5) Written 2008-2013 by schokokeks.org Hosting, namely
6) Bernd Wurst <bernd@schokokeks.org>
7) Hanno Böck <hanno@schokokeks.org>
8)
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10)
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12) http://creativecommons.org/publicdomain/zero/1.0/
13)
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
16)
17) require_once('inc/debug.php');
18) require_once('inc/db_connect.php');
19) require_once('inc/base.php');
20) require_once('inc/security.php');
21) require_once('inc/error.php');
22)
23) require_once('terions.php');
24)
25)
26) function get_domain_offer($domainname)
27) {
28) $domainname = filter_input_hostname($domainname);
29) $domainname = preg_replace('/^www\./', '', $domainname);
30) if (preg_match('/.*\..*\..*/', $domainname)) {
31) warning('zu viele Punkte im Domainname');
32) return;
33) }
34) $basename = preg_replace('/\..*$/', '', $domainname);
35) DEBUG('Found Basename: '.$basename);
36) $tld = preg_replace('/^.*\./', '', $domainname);
37) DEBUG('Found TLD: '.$tld);
38)
|
Lese Kunden-Sonderpreise fü...
Bernd Wurst authored 10 years ago
|
39) $cid = (int) $_SESSION['customerinfo']['customerno'];
40)
|
Neues Modul zum Prüfen der...
Bernd Wurst authored 10 years ago
|
41) $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
42)
|
Lese Kunden-Sonderpreise fü...
Bernd Wurst authored 10 years ago
|
43) $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde={$cid} AND tld='{$tld}' AND ruecksprache='N'");
44) if (mysql_num_rows($result) != 1) {
45) $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld='{$tld}' AND ruecksprache='N'");
46) }
|
Neues Modul zum Prüfen der...
Bernd Wurst authored 10 years ago
|
47) if (mysql_num_rows($result) != 1) {
48) warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
49) return;
50) }
51) $temp = mysql_fetch_assoc($result);
52) $data["gebuehr"] = $temp["gebuehr"];
53) $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
54)
55) $available = terions_available($domainname);
56) if (! $available) {
57) warning('Die Domain »'.$domainname.'« ist leider nicht verfügbar.');
58) return;
59) }
60) return $data;
61) }
62)
63)
64)
65) function register_domain($domainname, $uid)
66) {
67) $data = get_domain_offer($domainname);
68)
69) if (! $data) {
70) // Die Include-Datei setzt eine passende Warning-Nachricht
71) show_warnings();
72) system_failure('Interner Fehler');
73) }
74)
75) $cid = (int) $_SESSION['customerinfo']['customerno'];
76) $useraccount = NULL;
77) $available_users = list_useraccounts();
78) foreach ($available_users as $u) {
79) if ($uid == $u['uid']) {
80) $useraccount = (int) $uid;
81) break;
82) }
83) }
84) if (! $useraccount) {
85) system_failure('Kein User gesetzt');
86) }
87)
88) db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ({$cid}, {$useraccount}, '{$data['basename']}', '{$data['tld']}', 'regular', NULL, 1, 1, 'auto', 'terions', {$data['gebuehr']}, 1) ");
89) if ($data['setup']) {
|
Lese Kunden-Sonderpreise fü...
Bernd Wurst authored 10 years ago
|
90) db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES ({$cid}, 0, CURDATE(), {$data['setup']}, 1, 'Einmalige Setup-Gebühren für Domain \"{$data['domainname']}\"', 1)");
|