Minor improvements to telemetry/stats.php

This commit is contained in:
adolfintel 2019-01-30 17:10:27 +01:00
parent c31ebe8fdf
commit 6561d168c6

View file

@ -2,6 +2,9 @@
session_start(); session_start();
error_reporting(0); error_reporting(0);
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -62,7 +65,7 @@ if($stats_password=="PASSWORD"){
}else if($_SESSION["logged"]===true){ }else if($_SESSION["logged"]===true){
if($_GET["op"]=="logout"){ if($_GET["op"]=="logout"){
$_SESSION["logged"]=false; $_SESSION["logged"]=false;
?><script type="text/javascript">window.location.search=""</script><?php ?><script type="text/javascript">window.location=location.protocol+"//"+location.host+location.pathname;</script><?php
}else{ }else{
$conn=null; $conn=null;
if($db_type=="mysql"){ if($db_type=="mysql"){
@ -77,17 +80,18 @@ if($stats_password=="PASSWORD"){
$conn = new PDO("pgsql:$conn_host;$conn_db;$conn_user;$conn_password"); $conn = new PDO("pgsql:$conn_host;$conn_db;$conn_user;$conn_password");
}else die(); }else die();
?> ?>
<form action="stats.php?op=logout" method="POST"><input type="submit" value="Logout" /></form> <form action="stats.php" method="GET"><input type="hidden" name="op" value="logout" /><input type="submit" value="Logout" /></form>
<form action="stats.php?op=id" method="POST"> <form action="stats.php" method="GET">
<h3>Search test results</h6> <h3>Search test results</h6>
<input type="hidden" name="op" value="id" />
<input type="text" name="id" id="id" placeholder="Test ID" value=""/> <input type="text" name="id" id="id" placeholder="Test ID" value=""/>
<input type="submit" value="Find" /> <input type="submit" value="Find" />
<input type="submit" onclick="document.getElementById('id').value=''" value="Show last 100 tests" /> <input type="submit" onclick="document.getElementById('id').value=''" value="Show last 100 tests" />
</form> </form>
<?php <?php
$q=null; $q=null;
if($_GET["op"]=="id"&&!empty($_POST["id"])){ if($_GET["op"]=="id"&&!empty($_GET["id"])){
$id=$_POST["id"]; $id=$_GET["id"];
if($enable_id_obfuscation) $id=deobfuscateId($id); if($enable_id_obfuscation) $id=deobfuscateId($id);
if($db_type=="mysql"){ if($db_type=="mysql"){
$q=$conn->prepare("select id,timestamp,ip,ispinfo,ua,lang,dl,ul,ping,jitter,log,extra from speedtest_users where id=?"); $q=$conn->prepare("select id,timestamp,ip,ispinfo,ua,lang,dl,ul,ping,jitter,log,extra from speedtest_users where id=?");
@ -150,7 +154,7 @@ if($stats_password=="PASSWORD"){
}else{ }else{
if($_GET["op"]=="login"&&$_POST["password"]===$stats_password){ if($_GET["op"]=="login"&&$_POST["password"]===$stats_password){
$_SESSION["logged"]=true; $_SESSION["logged"]=true;
?><script type="text/javascript">window.location.search=""</script><?php ?><script type="text/javascript">window.location=location.protocol+"//"+location.host+location.pathname;</script><?php
}else{ }else{
?> ?>
<form action="stats.php?op=login" method="POST"> <form action="stats.php?op=login" method="POST">