HEX
Server: Apache/2.4.61 (Ubuntu)
System: Linux hosting106 7.0.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.12-1 (2026-06-09T21:07Z) x86_64
User: clinicadentalargarate.com (1193)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/webmin/virtualmin-powerdns/virtualmin-powerdns-lib.pl
do '../web-lib.pl';
&init_config();
do '../ui-lib.pl';
use DBI;

# connect_to_database()
sub connect_to_database
{
local ($dbh, $err);
eval {
	local $drh = DBI->install_driver("mysql");
	$drh->{'RaiseError'} = 1;
	$dbh = $drh->connect("database=$config{'db'}".
			     ($config{'host'} ? ";host=$config{'host'}" : ""),
			     $config{'user'}, $config{'pass'}, { });
	$dbh->{'RaiseError'} = 1;
	};
if ($@ || !$dbh) {
	$err = $@ || "unknown error";
	}
$err =~ s/\s+at\s+.*//;
return wantarray ? ($dbh, $err) : $dbh;
}

$template_file = "$module_config_directory/template";

# get_template()
# Returns an array of current record templates
sub get_template
{
local @rv;
open(FILE, -r $template_file ? $template_file
			     : "$module_root_directory/default-template");
while(<FILE>) {
	s/\r|\n//g;
	local @f = split(/\t+/, $_);
	if (@f == 4) {
		push(@rv, { 'name' => $f[0],
			    'type' => $f[1],
			    'ttl' => $f[2],
			    'value' => $f[3] });
		}
	}
close(FILE);
return @rv;
}

# save_template(value, ...)
# Updates the template file
sub save_template
{
open(FILE, ">$template_file");
local $f;
foreach $f (@_) {
	print FILE join("\t", $f->{'name'}, $f->{'type'},
			      $f->{'ttl'}, $f->{'value'}),"\n";
	}
close(FILE);
}

# domain_id(&dbh, name)
sub domain_id
{
local $idcmd = $_[0]->prepare("select id from domains where name = ? and type = 'NATIVE'");
$idcmd->execute($_[1]);
my ($id) = $idcmd->fetchrow();
$idcmd->finish();
return $id;
}

1;