function dns_do_action_toevoegen($account, $type = 'domain', $admin = 2) { global $lang; global $mysqli; if (!isset($mysqli) || empty($mysqli)) { create_db_connection('mysqli', 'central'); } global $mysqli; global $mysqli_dns; if (!isset($mysqli_dns) || empty($mysqli_dns)) { create_db_connection('mysqli_dns', 'dns'); } global $mysqli_dns; if (get_value_post('select_temp') != FALSE) { $templates = dns_get_value_available_templates($account, 3); $temp = 0; foreach ($templates as $template_temp) { if ($template_temp['id'] == get_value_post('select_temp')) { $template = $template_temp; $temp = 1; } } $ns = 0; if ($temp === 0) { $html = '<br /><br /><p>' . $lang->translate(737) . '</p><br /><br />'; } else { $sql = 'SELECT * FROM `dns_templates_records` WHERE `template_id` LIKE "' . $mysqli->real_escape_string($template['id']) . '"'; $query = $mysqli->query($sql); $num = 0; if (!isset($query) || empty($query) || $query->num_rows == "0") { $html = '<br /><br /><p>' . $lang->translate(737) . '</p><br /><br />'; } else { while ($row = $query->fetch_array(MYSQLI_ASSOC)) { $num++; $return[$row['id']]['name'] = dns_do_action_fill_template($row['name'], get_value_post('domein'), get_value_post('ipv4'), get_value_post('ipv6')); $return[$row['id']]['type'] = dns_do_action_fill_template($row['type'], get_value_post('domein'), get_value_post('ipv4'), get_value_post('ipv6')); $return[$row['id']]['content'] = dns_do_action_fill_template($row['content'], get_value_post('domein'), get_value_post('ipv4'), get_value_post('ipv6')); $return[$row['id']]['ttl'] = dns_do_action_fill_template($row['ttl'], get_value_post('domein'), get_value_post('ipv4'), get_value_post('ipv6')); $return[$row['id']]['prio'] = dns_do_action_fill_template($row['prio'], get_value_post('domein'), get_value_post('ipv4'), get_value_post('ipv6')); if ($ns === 0) { if ($return[$row['id']]['type'] == "NS") { $ns = $return[$row['id']]['content']; } } } } if ($num === 0 || $ns === 0) { $html = '<br /><br /><p>' . $lang->translate(737) . '</p><br /><br />'; } else { if (get_value_post('koppelen') == 'ja') { $sql2 = 'INSERT INTO `domains` (`name`,`account`,`template`,`type`,`changed`) VALUES ("' . $mysqli_dns->real_escape_string(get_value_post('domein')) . '","' . $mysqli_dns->real_escape_string($account) . '","' . $mysqli_dns->real_escape_string($template['id']) . '","NATIVE","1")'; } else { $sql2 = 'INSERT INTO `domains` (`name`,`account`,`type`,`changed`) VALUES ("' . $mysqli_dns->real_escape_string(get_value_post('domein')) . '","' . $mysqli_dns->real_escape_string($account) . '","NATIVE","1")'; } //var_dump($sql2); $query2 = $mysqli_dns->query($sql2); $id = $mysqli_dns->insert_id; //var_dump($mysqli_dns->insert_id); //var_dump($id); if ($id != 0) { $soa = $ns . ' postmaster.dnsshop.org ' . date("YmdH") . ' 3600 600 86400 900'; $mysqli_dns->query("INSERT INTO `records` (`domain_id`,`name`,`type`,`content`,`ttl`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string(get_value_post('domein')) . "','SOA','" . $mysqli_dns->real_escape_string($soa) . "','900')"); $mysqli_dns->query("UPDATE `domains` SET `changed` = +1 WHERE `id` = " . $mysqli_dns->real_escape_string($id) . " LIMIT 1"); foreach ($return as $record) { if ($type == 'domain') { if ($record['type'] == "MX") { $mysqli_dns->query("INSERT INTO `records` (`domain_id`,`name`,`type`,`content`,`ttl`,`prio`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "','" . $mysqli_dns->real_escape_string($record['prio']) . "')"); } else { if (stripos($record['name'], '[IPV6]') === FALSE && stripos($record['name'], '[IP6]') === FALSE && stripos($record['name'], '[IPV4]') === FALSE && stripos($record['name'], '[IP4]') === FALSE && stripos($record['content'], '[IPV6]') === FALSE && stripos($record['content'], '[IP6]') === FALSE && stripos($record['content'], '[IPV4]') === FALSE && stripos($record['content'], '[IP4]') === FALSE) { $mysqli_dns->query("INSERT INTO `records` (`domain_id`,`name`,`type`,`content`,`ttl`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "')"); } } } else { if ($record['type'] == "MX") { $mysqli->query("INSERT INTO `dns_templates_records` (`template_id`,`name`,`type`,`content`,`ttl`,`prio`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "','" . $mysqli_dns->real_escape_string($record['prio']) . "')"); } else { $mysqli->query("INSERT INTO `dns_templates_records` (`template_id`,`name`,`type`,`content`,`ttl`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "')"); } } } $html = '<br /><p>' . $lang->translate(740) . '</p><br />'; if ($type == 'domain') { $typurl = 'dom'; } else { $typurl = 'tem'; } if (check_user_right(get_value_session('from_db', 'id'), 'dns' . $typurl . 'bewerken', get_value_session('from_db', 'is_admin')) != FALSE) { $html .= dns_create_html_records(get_value_get('id'), $id, $type, 'bewerk', get_value_session('from_db', 'is_admin'), '?lang=' . lang_get_value_defaultlang() . '&page=dns&type=' . $typurl . 'bewerken&id=' . get_value_get('id') . '&domid=' . $id); } elseif (check_user_right(get_value_session('from_db', 'id'), 'dns' . $typurl . 'bekijken', get_value_session('from_db', 'is_admin')) != FALSE) { $html .= dns_create_html_records(get_value_get('id'), $id, $type, 'bekijk', get_value_session('from_db', 'is_admin')); } } else { $html = '<br /><br /><p>' . $lang->translate(737) . '</p><br /><br />'; } } } } else { $count = count($_POST['id']); $count = $count - 1; $ns = 0; $temp['name'] = get_value_post('name'); $temp['ttl'] = get_value_post('ttl'); $temp['prio'] = get_value_post('prio'); $temp['type'] = get_value_post('type'); $temp['content'] = get_value_post('content'); for ($i = 0; $i <= $count; $i++) { if (get_value_post('domein') !== FALSE && $type == 'domain') { $temp['name'][$i] = dns_do_action_fill_template($temp['name'][$i], get_value_post('domein')); $temp['content'][$i] = dns_do_action_fill_template($temp['content'][$i], get_value_post('domein')); } $info[$i]['name'] = $temp['name'][$i]; $info[$i]['ttl'] = $temp['ttl'][$i]; $info[$i]['prio'] = $temp['prio'][$i]; $info[$i]['type'] = strtoupper($temp['type'][$i]); $info[$i]['content'] = $temp['content'][$i]; if ($ns === 0) { if ($info[$i]['type'] == "NS") { $ns = $info[$i]['content']; } } } if ($ns === 0) { if ($type == 'domain') { $html = '<br /><br />' . $lang->translate(738) . '<br /><br />'; } else { $html = '<br /><br />' . $lang->translate(739) . '<br /><br />'; } } else { if ($type == 'domain') { global $mysqli_dns; if (!isset($mysqli_dns) || empty($mysqli_dns)) { create_db_connection('mysqli_dns', 'dns'); } global $mysqli_dns; } else { global $mysqli; if (!isset($mysqli) || empty($mysqli)) { create_db_connection('mysqli', 'central'); } global $mysqli; } if ($type == 'domain') { $sql2 = 'INSERT INTO `domains` (`name`,`account`,`changed`,`type`) VALUES ("' . $mysqli_dns->real_escape_string(get_value_post('domein')) . '","' . $mysqli_dns->real_escape_string($account) . '","1","NATIVE")'; $query2 = $mysqli_dns->query($sql2); $id = $mysqli_dns->insert_id; if ($id == 0) { $html = '<br /><br />' . $lang->translate(738) . '<br /><br />'; } else { $soa = $ns . ' postmaster.dnsshop.org ' . date("YmdH") . ' 3600 600 86400 900'; $mysqli_dns->query("INSERT INTO `records` (`domain_id`,`name`,`type`,`content`,`ttl`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string(get_value_post('domein')) . "','SOA','" . $mysqli_dns->real_escape_string($soa) . "','900')"); $mysqli_dns->query("UPDATE `domains` SET `changed` = +1 WHERE `id` = " . $mysqli_dns->real_escape_string($id) . " LIMIT 1"); } } else { $sql2 = 'INSERT INTO `dns_templates` (`name`,`account`) VALUES ("' . $mysqli->real_escape_string(get_value_post('domein')) . '","' . $mysqli_dns->real_escape_string($account) . '")'; $query2 = $mysqli->query($sql2); $id = $mysqli->insert_id; if ($id == 0) { $html = '<br /><br />' . $lang->translate(739) . '<br /><br />'; } } if ($id != 0) { foreach ($info as $record) { if ($type == 'domain') { if ($record['type'] == "MX") { $mysqli_dns->query("INSERT INTO `records` (`domain_id`,`name`,`type`,`content`,`ttl`,`prio`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "','" . $mysqli_dns->real_escape_string($record['prio']) . "')"); } else { $mysqli_dns->query("INSERT INTO `records` (`domain_id`,`name`,`type`,`content`,`ttl`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "')"); } } else { if ($record['type'] == "MX") { $mysqli->query("INSERT INTO `dns_templates_records` (`template_id`,`name`,`type`,`content`,`ttl`,`prio`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "','" . $mysqli_dns->real_escape_string($record['prio']) . "')") or die($mysqli->error); } else { $mysqli->query("INSERT INTO `dns_templates_records` (`template_id`,`name`,`type`,`content`,`ttl`) VALUES ('" . $mysqli_dns->real_escape_string($id) . "','" . $mysqli_dns->real_escape_string($record['name']) . "','" . $mysqli_dns->real_escape_string($record['type']) . "','" . $mysqli_dns->real_escape_string($record['content']) . "','" . $mysqli_dns->real_escape_string($record['ttl']) . "')") or die($mysqli->error); } } } } if ($id != 0) { if ($type == 'domain') { $html = '<br /><p>' . $lang->translate(740) . '</p><br />'; } else { $html = '<br /><p>' . $lang->translate(741) . '</p><br />'; } } if ($id != 0) { if ($type == 'domain') { $typurl = 'dom'; } else { $typurl = 'tem'; } if (check_user_right(get_value_session('from_db', 'id'), 'dns' . $typurl . 'bewerken', get_value_session('from_db', 'is_admin')) != FALSE) { $html .= dns_create_html_records(get_value_get('id'), $id, $type, 'bewerk', get_value_session('from_db', 'is_admin'), '?lang=' . lang_get_value_defaultlang() . '&page=dns&type=' . $typurl . 'bewerken&id=' . get_value_get('id') . '&domid=' . $id); } elseif (check_user_right(get_value_session('from_db', 'id'), 'dns' . $typurl . 'bekijken', get_value_session('from_db', 'is_admin')) != FALSE) { $html .= dns_create_html_records(get_value_get('id'), $id, $type, 'bekijk', get_value_session('from_db', 'is_admin')); } } } } return $html; }
$html .= '<br /><div class="content"><p>' . $lang->translate(717) . '<p /></div><br /><br />'; } else { $html .= '<br /><div class="content"><p>' . $lang->translate(758) . '<p /></div><br /><br />'; } } $html .= dns_create_html_records(get_value_get('id'), get_value_get('domid'), 'domain', 'bewerk', get_value_session('from_db', 'is_admin')); } elseif (get_value_get('type') == 'tembewerken' && check_user_right(get_value_session('from_db', 'id'), 'dnstembewerken', get_value_session('from_db', 'is_admin')) !== FALSE && get_value_get('id') !== FALSE) { if (get_value_post('submit')) { $replace = dns_do_action_replace_records(get_value_get('id'), get_value_get('temid'), 'template', get_value_session('from_db', 'is_admin')); if ($replace === FALSE) { $html .= '<br /><div class="content"><p>' . $lang->translate(717) . '<p /></div><br /><br />'; } else { $html .= '<br /><div class="content"><p>' . $lang->translate(758) . '<p /></div><br /><br />'; } } $html .= dns_create_html_records(get_value_get('id'), get_value_get('temid'), 'template', 'bewerk', get_value_session('from_db', 'is_admin')); } elseif (get_value_get('type') == 'temzoeken' && check_user_right(get_value_session('from_db', 'id'), 'dnstemzoeken', get_value_session('from_db', 'is_admin')) !== FALSE && get_value_get('id') !== FALSE) { if (get_value_post('submit')) { $search = dns_create_html_searchresults(dns_do_action_search(get_value_get('id'), get_value_post('search'), 'template', get_value_session('from_db', 'is_admin'))); if ($search === FALSE) { $html .= '<br /><div class="content"><p>' . $lang->translate(718) . '<p /></div><br /><br />'; } else { $html .= $search; } } else { $html .= dns_create_html_search('template'); } } elseif (get_value_get('type') == 'domzoeken' && check_user_right(get_value_session('from_db', 'id'), 'dnsdomzoeken', get_value_session('from_db', 'is_admin')) !== FALSE && get_value_get('id') !== FALSE) { if (get_value_post('submit')) { $search = dns_create_html_searchresults(dns_do_action_search(get_value_get('id'), get_value_post('search'), 'domain', get_value_session('from_db', 'is_admin'))); if ($search === FALSE) {