Skip to content

Commit ee405d8

Browse files
author
Florian Schaal
committed
Prevent empty hostname during install
1 parent b2f827b commit ee405d8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

install/install.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,18 @@
174174
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', @$tmp_out[0],'hostname');
175175
unset($tmp_out);
176176

177+
//** Prevent empty hostname
178+
$conf['hostname']=trim($conf['hostname']);
179+
if($conf['hostname'] === '') {
180+
$check = false;
181+
do {
182+
swriteln('Hostname may not be empty.');
183+
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', '', 'hostname');
184+
$conf['hostname']=trim($conf['hostname']);
185+
$check = @($conf['hostname'] !== '')?true:false;
186+
} while (!$check);
187+
}
188+
177189
// Check if the mysql functions are loaded in PHP
178190
if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.');
179191

@@ -861,4 +873,4 @@
861873
echo "Installation completed.\n";
862874

863875

864-
?>
876+
?>

0 commit comments

Comments
 (0)