Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add field for tester identification

  • Loading branch information...
commit 4891370521f2cc92f07cbb00878b3ba557d06ec7 1 parent 0f24e1d
@DanielMuller authored
Showing with 30 additions and 11 deletions.
  1. +28 −9 index.php
  2. +2 −2 store.php
View
37 index.php
@@ -4,10 +4,8 @@
* */
$cfg=parse_ini_file("speed.ini",true);
foreach ($cfg as $key=>$val) {
- if (strtolower($key)!="notify") {
- $cdn = ($val['cdn']==true) ? "true":"false";
- $locationcfg[]="{'location':'".$key."','url':'".$val['url']."','cdn':".$cdn."}";
- }
+ $cdn = ($val['cdn']==true) ? "true":"false";
+ $locationcfg[]="{'location':'".$key."','url':'".$val['url']."','cdn':".$cdn."}";
}
?>
<html>
@@ -383,7 +381,7 @@ function TestStarted( testId, count )
}
function storeResult() {
- $.post('store.php',{'json':JSON.stringify(result)});
+ $.post('store.php',{'json':JSON.stringify(result),'email':$('#email').val()});
}
function EndTest(res)
{
@@ -403,13 +401,30 @@ function EndTest(res)
}
var result=[];
-$( function()
-{
- count = 5;
- StartTest(0,count);
+$( function() {
+ $('#email').keypress(function(e) {
+ $('#email').removeClass('error');
+ });
+ $('#startme').click( function(e)
+ {
+ if ($('#email').val()=="") {
+ $('#email').addClass('error');
+ return false;
+ }
+ count = 5;
+ StartTest(0,count);
+ });
});
</script>
<style type="text/css">
+#email {
+ border:1px solid black;
+ background:white;
+}
+#email.error {
+ border:2px solid red;
+ background: #FFD0D0;
+}
.progressbarContainer {
position:relative;
width:400px;
@@ -434,6 +449,10 @@ function EndTest(res)
</style>
<body>
<h1>Spuul Speed Test</h1>
+<form action="<?= $_SERVER['PHP_SELF']?>" method="GET">
+Your E-Mail: <input type="text" name="email" id="email" />
+<input type="button" id="startme" value="Start">
+</form>
<table border="1" cellpadding="2" cellspacing="2">
<tr>
<th>Location</th>
View
4 store.php
@@ -35,7 +35,7 @@ function get_ip_info() {
$ua=$_SERVER['HTTP_USER_AGENT'];
-$log=date("Y-m-d H:i:s")."\t".$ip_info['ip']."\t".$ip_info['country']."\t".$ip_info['state/region'];
+$log=date("Y-m-d H:i:s")."\t".$_POST['email']."\n".$ip_info['ip']."\t".$ip_info['country']."\t".$ip_info['state/region'];
$log.="\t".$ip_info['city']."\t".$ip_info['isp']."\t".$ip_info['type'];
foreach ($result as $val) {
$log.="\t".$val->location."\t".$val->ping."\t".$val->speed."\t".$val->speedDetails;
@@ -47,7 +47,7 @@ function get_ip_info() {
fclose($fp);
$message="Test made on ".date(DATE_RFC822)."\n\n";
-$message.="From:\n";
+$message.="From: ".$_POST['email']."\n";
$message.="IP: ".$ip_info['ip']."\n";
$message.="Country: ".$ip_info['country']."\n";
if ($ip_info['state/region']) $message.="State: ".$ip_info['state/region']."\n";
Please sign in to comment.
Something went wrong with that request. Please try again.