speedtest/results/telemetry_settings.php

36 lines
1.3 KiB
PHP
Raw Normal View History

<?php
// Type of db: "mssql", "mysql", "sqlite" or "postgresql"
Refactor `results/` PHP code (#369) * 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
2020-10-20 05:43:48 +00:00
$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
Refactor `results/` PHP code (#369) * 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
2020-10-20 05:43:48 +00:00
$Sqlite_db_file = '../../speedtest_telemetry.sql';
// mssql settings
$MsSql_server = 'DB_HOSTNAME';
$MsSql_databasename = 'DB_NAME';
$MsSql_WindowsAuthentication = true; #true or false
$MsSql_username = 'USERNAME'; #not used if MsSql_WindowsAuthentication is true
$MsSql_password = 'PASSWORD'; #not used if MsSql_WindowsAuthentication is true
$MsSql_TrustServerCertificate = true; #true, false or comment out for driver default
#Download driver from https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver16
// Mysql settings
Refactor `results/` PHP code (#369) * 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
2020-10-20 05:43:48 +00:00
$MySql_username = 'USERNAME';
$MySql_password = 'PASSWORD';
$MySql_hostname = 'DB_HOSTNAME';
$MySql_databasename = 'DB_NAME';
$MySql_port = '3306';
// Postgresql settings
Refactor `results/` PHP code (#369) * 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
2020-10-20 05:43:48 +00:00
$PostgreSql_username = 'USERNAME';
$PostgreSql_password = 'PASSWORD';
$PostgreSql_hostname = 'DB_HOSTNAME';
$PostgreSql_databasename = 'DB_NAME';