Bandwidthmeter
Installation Database Check
$message";
} else {
echo "$message
";
}
}
$data_file = $home . "payload.bin";
if ( $fd = fopen ($data_file, "rb") ) {
print_message("Payload file successfully found and opened.", 0);
} else {
print_message("Could not access payload file.", 1);
}
if ($mysql == True) {
if ($link = @mysql_connect($database["host"], $database["login"],
$database["password"])) {
print_message("Successfully connected to database.", 0);
} else {
print_message("Could not connect to the database. Make sure that you have
added the proper user and password. Also, make sure that the user
has permission to connect to the host. You may need to explicitly
add the host (in some cases localhost) that the user can connect
from.", 1);
}
if (mysql_select_db($database["database"])) {
print_message("Successfully selected the database.", 0);
$query = "INSERT INTO readings (speed, ip, name) VALUES ('12345',
'10.10.10.10', '123.yourdomain.com')";
if ($result = mysql_query($query)) {
print_message("Successfully inserted test record.", 0);
$query = "DELETE FROM readings WHERE name='123.yourdomain.com'";
if ($result = mysql_query($query)) {
print_message("Successfully deleted test record.", 0);
} else {
print_message("Unable to delete test record from database. The user
may not have been granted the DELETE privilege.", 1);
}
} else {
print_message("Unable to insert test record into database. The user
may have not been granted the INSERT privilege.", 1);
}
} else {
print_message("Could not select database. The user may not have
permission to connect to the database or the database may have not
been created.", 1);
}
if ($errored==0) {
$meter_location = "http://$HTTP_HOST";
if ($use_initialmeter == True) {
$meter_location .= ereg_replace("install.php", "initialmeter.php",
$_SERVER['PHP_SELF']);
} else {
$meter_location .= ereg_replace("install.php", "meter.php",
$_SERVER['PHP_SELF']);
}
print_message("SUCCESSFULLY PASSED TESTS.
You may now test your
download speed at $meter_location", 0);
}
} else {
echo "MySQL database support not turned on. Bandwidthmeter will work
without a database, but will not log results. You may turn on MySQL
support in the config.inc.php file. Please make sure to configure
the database properly (directions are in ./docs/INSTALL). Then reload
this page to test whether Bandwidthmeter can connect to the database.";
}
?>