26 lines
814 B
PHP
26 lines
814 B
PHP
<?php
|
|
|
|
// Make sure we are called from index.php
|
|
if (!defined('SECURITY'))
|
|
die('Hacking attempt');
|
|
|
|
// Instantiate class, we are using mysqlng
|
|
if ($config['strict']) {
|
|
$mysqli = new mysqli_strict($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']) or die('couldnt load class');
|
|
//$mysqli = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
|
} else {
|
|
|
|
}
|
|
|
|
// Check if read-only and quit if it is on
|
|
if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS read_only')->fetch_object()->read_only == 1) {
|
|
die('Database is in READ-ONLY mode');
|
|
}
|
|
|
|
/* check connection */
|
|
if (mysqli_connect_errno()) {
|
|
die("Failed to connect to database");
|
|
}
|
|
|
|
?>
|