From 09640bc9d6311f7e87bf075b74efa0f8f035a3c9 Mon Sep 17 00:00:00 2001 From: dosse91 Date: Tue, 5 Sep 2017 07:57:44 +0200 Subject: [PATCH 1/4] Changes --- doc.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/doc.md b/doc.md index d21e1fb..5da32a1 100644 --- a/doc.md +++ b/doc.md @@ -1,7 +1,7 @@ # HTML5 Speedtest > by Federico Dossena -> Version 4.3.1, August 25 2017 +> Version 4.3.2, September 5 2017 > [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/) @@ -249,21 +249,23 @@ You need to start the test with your replacements like this: w.postMessage('start {"url_dl": "newGarbageURL", "url_ul": "newEmptyURL", "url_ping": "newEmptyURL", "url_getIp": "newIpURL"}') ``` ## Telemetry -Telemetry currently requires PHP and MySQL. +Telemetry currently requires PHP and either MySQL or SQLite. To set up the telemetry, we need to do 4 things: * copy `telemetry.php` -* edit `telemetry.php` to add your database access credentials +* edit `telemetry.php` to add your database settings * create the database * enable telemetry ### Creating the database -At the moment, only MySQL is supported. +This step is only for MySQL. Skip this if you want to use SQLite. Log into your database using phpMyAdmin or a similar software and import `telemetry.sql` into an empty database. If you see a table called `speedtest_users`, empty, you did it right. ### Configuring `telemetry.php` -Open telemetry.php with notepad or a similar text editor, and insert your database access credentials -``` +Open telemetry.php with notepad or a similar text editor. +Set your preferred database, ``$db_type="mysql";`` or ``$db_type="sqlite";`` +If you choose to use MySQL, you must also add your database credentials: +```php $MySql_username="USERNAME"; //your database username $MySql_password="PASSWORD"; //your database password $MySql_hostname="DB_HOSTNAME"; //database address, usually localhost\ @@ -278,7 +280,7 @@ There are 3 levels: * `full`: same as above, but also collects a log (10-150 Kb each, not recommended) Example: -``` +```js w.postMessage('start {"telemetry_level":"basic"}') ``` From 695f063ce9962d36c2e7db1d78fa922d8a92e262 Mon Sep 17 00:00:00 2001 From: dosse91 Date: Tue, 5 Sep 2017 07:57:48 +0200 Subject: [PATCH 2/4] Revert "Changes" This reverts commit 09640bc9d6311f7e87bf075b74efa0f8f035a3c9. --- doc.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/doc.md b/doc.md index 5da32a1..d21e1fb 100644 --- a/doc.md +++ b/doc.md @@ -1,7 +1,7 @@ # HTML5 Speedtest > by Federico Dossena -> Version 4.3.2, September 5 2017 +> Version 4.3.1, August 25 2017 > [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/) @@ -249,23 +249,21 @@ You need to start the test with your replacements like this: w.postMessage('start {"url_dl": "newGarbageURL", "url_ul": "newEmptyURL", "url_ping": "newEmptyURL", "url_getIp": "newIpURL"}') ``` ## Telemetry -Telemetry currently requires PHP and either MySQL or SQLite. +Telemetry currently requires PHP and MySQL. To set up the telemetry, we need to do 4 things: * copy `telemetry.php` -* edit `telemetry.php` to add your database settings +* edit `telemetry.php` to add your database access credentials * create the database * enable telemetry ### Creating the database -This step is only for MySQL. Skip this if you want to use SQLite. +At the moment, only MySQL is supported. Log into your database using phpMyAdmin or a similar software and import `telemetry.sql` into an empty database. If you see a table called `speedtest_users`, empty, you did it right. ### Configuring `telemetry.php` -Open telemetry.php with notepad or a similar text editor. -Set your preferred database, ``$db_type="mysql";`` or ``$db_type="sqlite";`` -If you choose to use MySQL, you must also add your database credentials: -```php +Open telemetry.php with notepad or a similar text editor, and insert your database access credentials +``` $MySql_username="USERNAME"; //your database username $MySql_password="PASSWORD"; //your database password $MySql_hostname="DB_HOSTNAME"; //database address, usually localhost\ @@ -280,7 +278,7 @@ There are 3 levels: * `full`: same as above, but also collects a log (10-150 Kb each, not recommended) Example: -```js +``` w.postMessage('start {"telemetry_level":"basic"}') ``` From 2fda447449b9214b8cd720eb04653585f666fe4a Mon Sep 17 00:00:00 2001 From: Slawka Date: Tue, 5 Sep 2017 09:00:05 +0300 Subject: [PATCH 3/4] New type of database sqlite (#58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ability to select sqlite as a data source, it is desirable to put the catalog above the web or to forbid downloading ---------- Возможность выбора sqlite в качестве бызы данных, желательно поместить каталогом выше веб или запретить скачивание --- telemetry.php | 50 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/telemetry.php b/telemetry.php index 14d4463..f27d0b9 100644 --- a/telemetry.php +++ b/telemetry.php @@ -1,8 +1,5 @@ prepare("INSERT INTO speedtest_users (ip,ua,lang,dl,ul,ping,jitter,log) VALUES (?,?,?,?,?,?,?,?)") or die("2"); -$stmt->bind_param("ssssssss",$ip,$ua,$lang,$dl,$ul,$ping,$jitter,$log) or die("3"); -$stmt->execute() or die("4"); -$stmt->close() or die("5"); -$conn->close() or die("6"); +if($db_type=="mysql"){ + $MySql_username="USERNAME"; + $MySql_password="PASSWORD"; + $MySql_hostname="DB_HOSTNAME"; + $MySql_databasename="DB_NAME"; -?> \ No newline at end of file + + $conn = new mysqli($MySql_hostname, $MySql_username, $MySql_password, $MySql_databasename) or die("1"); + $stmt = $conn->prepare("INSERT INTO speedtest_users (ip,ua,lang,dl,ul,ping,jitter,log) VALUES (?,?,?,?,?,?,?,?)") or die("2"); + $stmt->bind_param("ssssssss",$ip,$ua,$lang,$dl,$ul,$ping,$jitter,$log) or die("3"); + $stmt->execute() or die("4"); + $stmt->close() or die("5"); + $conn->close() or die("6"); + +}elseif($db_type=="sqlite"){ + + $file_db = "../telemetry.sql"; + + $conn = new PDO("sqlite:$file_db") or die("1"); + $conn->exec(" + CREATE TABLE IF NOT EXISTS `speedtest_users` ( + `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ip` text NOT NULL, + `ua` text NOT NULL, + `lang` text NOT NULL, + `dl` text, + `ul` text, + `ping` text, + `jitter` text, + `log` longtext + ); + "); + $stmt = $conn->prepare("INSERT INTO speedtest_users (ip,ua,lang,dl,ul,ping,jitter,log) VALUES (?,?,?,?,?,?,?,?)") or die("2"); + $stmt->execute(array($ip,$ua,$lang,$dl,$ul,$ping,$jitter,$log)) or die("3"); + $conn = null; + +} +?> From 929a7221ebc07125de97f18803953e42402399ac Mon Sep 17 00:00:00 2001 From: dosse91 Date: Tue, 5 Sep 2017 07:58:48 +0200 Subject: [PATCH 4/4] Updated documentation and telemetry --- doc.md | 16 +++++++++------- telemetry.php | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc.md b/doc.md index d21e1fb..5da32a1 100644 --- a/doc.md +++ b/doc.md @@ -1,7 +1,7 @@ # HTML5 Speedtest > by Federico Dossena -> Version 4.3.1, August 25 2017 +> Version 4.3.2, September 5 2017 > [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/) @@ -249,21 +249,23 @@ You need to start the test with your replacements like this: w.postMessage('start {"url_dl": "newGarbageURL", "url_ul": "newEmptyURL", "url_ping": "newEmptyURL", "url_getIp": "newIpURL"}') ``` ## Telemetry -Telemetry currently requires PHP and MySQL. +Telemetry currently requires PHP and either MySQL or SQLite. To set up the telemetry, we need to do 4 things: * copy `telemetry.php` -* edit `telemetry.php` to add your database access credentials +* edit `telemetry.php` to add your database settings * create the database * enable telemetry ### Creating the database -At the moment, only MySQL is supported. +This step is only for MySQL. Skip this if you want to use SQLite. Log into your database using phpMyAdmin or a similar software and import `telemetry.sql` into an empty database. If you see a table called `speedtest_users`, empty, you did it right. ### Configuring `telemetry.php` -Open telemetry.php with notepad or a similar text editor, and insert your database access credentials -``` +Open telemetry.php with notepad or a similar text editor. +Set your preferred database, ``$db_type="mysql";`` or ``$db_type="sqlite";`` +If you choose to use MySQL, you must also add your database credentials: +```php $MySql_username="USERNAME"; //your database username $MySql_password="PASSWORD"; //your database password $MySql_hostname="DB_HOSTNAME"; //database address, usually localhost\ @@ -278,7 +280,7 @@ There are 3 levels: * `full`: same as above, but also collects a log (10-150 Kb each, not recommended) Example: -``` +```js w.postMessage('start {"telemetry_level":"basic"}') ``` diff --git a/telemetry.php b/telemetry.php index f27d0b9..61458f3 100644 --- a/telemetry.php +++ b/telemetry.php @@ -1,5 +1,5 @@