mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Added DB Host Access option to localhost console installation TICKETS #3363
This commit is contained in:
parent
b78c5a51f4
commit
c12ec81bb7
@ -702,18 +702,35 @@ function install_step3() {
|
|||||||
<td>DB Name (pandora by default)<br>
|
<td>DB Name (pandora by default)<br>
|
||||||
<input class='login' type='text' name='dbname' value='pandora' size=20>
|
<input class='login' type='text' name='dbname' value='pandora' size=20>
|
||||||
|
|
||||||
<tr><td valign=top>
|
<tr>";
|
||||||
|
if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
|
||||||
|
|
||||||
|
echo "<td>DB Host Access<br>
|
||||||
|
<span style='font-size: 9px'>Ignored if DB Hostname is localhost</span>
|
||||||
|
<input class='login' type='text' name='dbgrant' value='" . $_SERVER['SERVER_ADDR'] . "' size=20>";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
echo "<td valign=top>
|
||||||
Drop Database if exists<br>
|
Drop Database if exists<br>
|
||||||
<input class='login' type='checkbox' name='drop' value=1>
|
<input class='login' type='checkbox' name='drop' value=1>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<td>Full path to HTTP publication directory<br>
|
||||||
<td>Full path to HTTP publication directory<br>
|
|
||||||
<span style='font-size: 9px'>For example /var/www/pandora_console/</span>
|
<span style='font-size: 9px'>For example /var/www/pandora_console/</span>
|
||||||
<br>
|
<br>
|
||||||
<input class='login' type='text' name='path' style='width: 240px;'
|
<input class='login' type='text' name='path' style='width: 240px;'
|
||||||
value='".dirname (__FILE__)."'>
|
value='".dirname (__FILE__)."'>
|
||||||
|
|
||||||
<tr><td></td><td>URL path to Pandora FMS Console<br>
|
<tr>";
|
||||||
|
if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
|
||||||
|
echo "<td valign=top>
|
||||||
|
Drop Database if exists<br>
|
||||||
|
<input class='login' type='checkbox' name='drop' value=1>
|
||||||
|
";
|
||||||
|
} else {
|
||||||
|
echo "<td>";
|
||||||
|
}
|
||||||
|
echo "<td>URL path to Pandora FMS Console<br>
|
||||||
<span style='font-size: 9px'>For example '/pandora_console'</span>
|
<span style='font-size: 9px'>For example '/pandora_console'</span>
|
||||||
</br>
|
</br>
|
||||||
<input class='login' type='text' name='url' style='width: 250px;'
|
<input class='login' type='text' name='url' style='width: 250px;'
|
||||||
@ -750,6 +767,7 @@ function install_step4() {
|
|||||||
$dbname = "";
|
$dbname = "";
|
||||||
$engine = "";
|
$engine = "";
|
||||||
$dbaction = "";
|
$dbaction = "";
|
||||||
|
$dbgrant = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$engine = $_POST['engine'];
|
$engine = $_POST['engine'];
|
||||||
@ -757,6 +775,10 @@ function install_step4() {
|
|||||||
$dbuser = $_POST["user"];
|
$dbuser = $_POST["user"];
|
||||||
$dbhost = $_POST["host"];
|
$dbhost = $_POST["host"];
|
||||||
$dbaction = $_POST["db_action"];
|
$dbaction = $_POST["db_action"];
|
||||||
|
if (isset($_POST["dbgrant"]) && $_POST["dbgrant"] != "")
|
||||||
|
$dbgrant = $_POST["dbgrant"];
|
||||||
|
else
|
||||||
|
$dbgrant = $_SERVER["SERVER_ADDR"];
|
||||||
if (isset($_POST["drop"]))
|
if (isset($_POST["drop"]))
|
||||||
$dbdrop = $_POST["drop"];
|
$dbdrop = $_POST["drop"];
|
||||||
else
|
else
|
||||||
@ -825,7 +847,7 @@ function install_step4() {
|
|||||||
$random_password = random_name (8);
|
$random_password = random_name (8);
|
||||||
$host = 'localhost';
|
$host = 'localhost';
|
||||||
if ($dbhost != 'localhost')
|
if ($dbhost != 'localhost')
|
||||||
$host = $_SERVER['SERVER_ADDR'];
|
$host = $dbgrant;
|
||||||
$step5 = mysql_query ("GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host
|
$step5 = mysql_query ("GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host
|
||||||
IDENTIFIED BY '".$random_password."'");
|
IDENTIFIED BY '".$random_password."'");
|
||||||
mysql_query ("FLUSH PRIVILEGES");
|
mysql_query ("FLUSH PRIVILEGES");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user