function getSqliteVersion()
{
    $output = shell_exec('sqlite3 -version');
    preg_match('@[0-9]+\\.[0-9]+\\.[0-9]+@', $output, $version);
    if (isset($version[0])) {
        return $version[0];
    } else {
        return 0;
    }
    // Sqlite not installed
}
/*
 * main program
 */
echo "\nWebacula check System Requirements...\n\n";
$mysql_ver = getMySQLversion();
$pgsql_ver = getPgSQLversion();
$sqlite_ver = getSqliteVersion();
if ($mysql_ver == 0 && $pgsql_ver == 0 && $sqlite_ver == 0) {
    echo "ERROR! SQL server not found!\n";
} else {
    if ($mysql_ver) {
        echo 'Current MySQL version = ', $mysql_ver;
        if (version_compare($mysql_ver, $MYSQLV) === -1) {
            echo "\tWarning. Upgrade your MySQL version to {$MYSQLV} or later\n";
        } else {
            echo "\tOK\n";
        }
    }
    if ($pgsql_ver) {
        echo 'Current PostgreSQL version = ', $pgsql_ver;
Exemple #2
0
 // (1) Open the database connection and use the mysql database:
 if (!($connection = @mysql_connect($hostName, $adminUserName, $adminPassword))) {
     if (mysql_errno() != 0) {
         // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
         showErrorMsg("The following error occurred while trying to connect to the host:", "");
     }
 }
 if (!mysql_select_db($adminDatabaseName, $connection)) {
     if (mysql_errno() != 0) {
         // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
         showErrorMsg("The following error occurred while trying to connect to the database:", "");
     }
 }
 // First, check if we're a dealing with MySQL version 4.1.x or greater:
 // (MySQL 4.1.x is required if the refbase MySQL database/tables shall be installed using Unicode/UTF-8 as default character set)
 $mysqlVersion = getMySQLversion();
 // function 'getMySQLversion()' is defined in 'include.inc.php'
 // --------------------------------------------------------------------
 // Prepare the install queries and proceed with the actual installation procedure:
 // Build the database queries required for installation:
 $queryGrantStatement = "GRANT SELECT,INSERT,UPDATE,DELETE ON " . $databaseName . ".* TO " . quote_smart($username) . "@" . quote_smart($hostName) . " IDENTIFIED BY " . quote_smart($password);
 $queryCreateDB = "CREATE DATABASE IF NOT EXISTS " . $databaseName;
 // by default, 'latin1' will be used as default character set
 if ($mysqlVersion >= 4.1) {
     $queryCreateDB = $queryCreateDB . " DEFAULT CHARACTER SET " . $defaultCharacterSet;
     // ...add the default character set chosen by the user
     if ($defaultCharacterSet == "utf8") {
         // ...in case of UTF-8, adjust the path to the default database structure file if necessary
         if ($databaseStructureFile == "./install.sql") {
             $databaseStructureFile = "./install_utf8.sql";
         }
Exemple #3
0
function connectToMySQLDatabase()
{
    global $hostName;
    // these variables are specified in 'db.inc.php'
    global $username;
    global $password;
    global $databaseName;
    global $contentTypeCharset;
    // defined in 'ini.inc.php'
    global $connection;
    // If a connection parameter is not available, then use our own connection to avoid any locking problems
    if (!isset($connection)) {
        // (1) OPEN the database connection:
        //      (variables are set by include file 'db.inc.php'!)
        if (!($connection = @mysql_connect($hostName, $username, $password))) {
            if (mysql_errno() != 0) {
                // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
                showErrorMsg("The following error occurred while trying to connect to the host:");
            }
        }
        //     Get the MySQL version and save it to a session variable:
        if (!isset($_SESSION['mysqlVersion'])) {
            saveSessionVariable("mysqlVersion", getMySQLversion());
        }
        // (2) Set the connection character set (if connected to MySQL 4.1.x or greater):
        //     more info at <http://dev.mysql.com/doc/refman/5.1/en/charset-connection.html>
        if (isset($_SESSION['mysqlVersion']) and $_SESSION['mysqlVersion'] >= 4.1) {
            // NOTE: "SET NAMES ..." requires MySQL 4.1 or greater
            if ($contentTypeCharset == "UTF-8") {
                queryMySQLDatabase("SET NAMES utf8");
            } else {
                queryMySQLDatabase("SET NAMES latin1");
            }
            // by default, we establish a 'latin1' connection
        }
        // (3) SELECT the database:
        //      (variables are set by include file 'db.inc.php'!)
        if (!mysql_select_db($databaseName, $connection)) {
            if (mysql_errno() != 0) {
                // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
                showErrorMsg("The following error occurred while trying to connect to the database:");
            }
        }
    }
}
Exemple #4
0
            $MySQL_directive_objects[$i]->setRecommendedValue(mysql_result($directives, $i, 'recomendedvalue'));
            $MySQL_directive_objects[$i]->setCurrentValue($MySQL_directive_objects[$i]->getCurrentValue($MySQL_directive_objects[$i]->getDirectiveName(), $phpini_path));
            $MySQL_directive_objects[$i]->setDescription(mysql_result($directives, $i, 'description'));
            $MySQL_directive_objects[$i]->setRemark(mysql_result($directives, $i, 'remark'));
            $MySQL_directive_objects[$i]->setPossibleValues("this is an array that comes from values table per each directive");
        }
    }
    ?>
    
    <table cellpadding="0" cellspacing="0">
        <tr> <td align="right"><b>Operating System:</b></td> <td><?php 
    echo " " . getOS();
    ?>
</td> </tr>
        <tr> <td align="right"><b>MySQL Version:</b></td> <td><?php 
    echo " MySQL " . getMySQLversion();
    ?>
</td> </tr>

    </table>
    <br />
     <form name="changeForm" method="POST" action="change.php">
     <table border="1" cellspacing="0" cellpadding="0" >
         <th bgcolor="white" colspan="7"><h1>MySQL Server Security Configuration Details</h1></th>

         <tr bgcolor="white">

             <td align="center"><b>No.</b></td><td align="center"><b>Name</b></td><td align="center"><b>Recommended</b></td>
             <td align="center"><b>Current</b></td><td align="center"><b>Remarks</b></td><td><b>Values</b></td>
         </tr>
         <?php