
* put code to insert and query data from database into separate file * simplify obfuscation salt file handling * use new DB interaction functions in telemetry.php * use new DB interaction functions in stats.php and fix indentation levels * format telemetry settings file * use new function for interacting with DB in index.php * move drawing of the image into function and try to comment each section with what it does * reorder lines for parts of the image to align with the order they appear on the image * bugfix: display obfuscated and deobfuscated id in stats if id obfuscation is enabled * improve error handling * add missing PHPDocs to functions * imageftbbox returns an array on success and false on failure so to check if the font is usable, check if we got an array * fix dsn for postgres * fix limit sql statement for postgresql * remove obsolete require statement * use require instead of require_once since the settings file might need to be loaded multiple times because it just contains plain variables which will just get loaded into the current scope * move require statements to the top of the file * make sure files are readable before requiring them * add constant to refer to the telemetry settings file and check if it is readable before loading it * return null if no speedtest result was found for the given id and show according message to the user instead of just exiting * use existing constant instead of string for telemetry settings file name * uniformly use single quotes instead of double quotes as most code places already used single quotes * somehow some tabs sneaked in, replace them to uniformly use spaces * mysql now uses pdo, too, reflect that in the requirements documentation * pass username and password as constructor parameters instead of via DSN
26 lines
822 B
PHP
26 lines
822 B
PHP
<?php
|
|
|
|
// Type of db: "mysql", "sqlite" or "postgresql"
|
|
$db_type = 'mysql';
|
|
// Password to login to stats.php. Change this!!!
|
|
$stats_password = 'PASSWORD';
|
|
// If set to true, test IDs will be obfuscated to prevent users from guessing URLs of other tests
|
|
$enable_id_obfuscation = false;
|
|
// If set to true, IP addresses will be redacted from IP and ISP info fields, as well as the log
|
|
$redact_ip_addresses = false;
|
|
|
|
// Sqlite3 settings
|
|
$Sqlite_db_file = '../../speedtest_telemetry.sql';
|
|
|
|
// Mysql settings
|
|
$MySql_username = 'USERNAME';
|
|
$MySql_password = 'PASSWORD';
|
|
$MySql_hostname = 'DB_HOSTNAME';
|
|
$MySql_databasename = 'DB_NAME';
|
|
$MySql_port = '3306';
|
|
|
|
// Postgresql settings
|
|
$PostgreSql_username = 'USERNAME';
|
|
$PostgreSql_password = 'PASSWORD';
|
|
$PostgreSql_hostname = 'DB_HOSTNAME';
|
|
$PostgreSql_databasename = 'DB_NAME';
|