From 766ae885f6763974fc131f3e6838483b0d171041 Mon Sep 17 00:00:00 2001 From: Otakar Andrysek Date: Fri, 27 Jan 2017 00:55:36 -0800 Subject: [PATCH 1/2] Separated MySQL Password --- .gitignore | 3 +++ index.html => index.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) rename index.html => index.php (99%) diff --git a/.gitignore b/.gitignore index 773bfd6..fba9338 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ .Trashes ehthumbs.db Thumbs.db + +# MySQL Password # +password.php diff --git a/index.html b/index.php similarity index 99% rename from index.html rename to index.php index 743d228..aa8216e 100755 --- a/index.html +++ b/index.php @@ -221,7 +221,7 @@

FOOTER

} $sql = "INSERT INTO results (name, net_wpm, gross_wpm, error, accuracy) -VALUES ('$name', '0', '0', '0', '0')"; +VALUES ('0', '0', '0', '0', '0')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; From 6b8db80f4c9f007ebe39f621d0a9c5f3319c5e31 Mon Sep 17 00:00:00 2001 From: Otakar Andrysek Date: Fri, 27 Jan 2017 01:51:39 -0800 Subject: [PATCH 2/2] MySQL now inserts name --- index.php | 8 ++++++-- js/main.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index aa8216e..13f901a 100755 --- a/index.php +++ b/index.php @@ -21,6 +21,9 @@ Your Input:"; echo $name; + echo $person; + echo "\n"; $servername = "localhost"; $username = "www"; -$password = "[HIDDEN]"; // TODO: Remove password from index.php by calling password from another file $dbname = "typing_test"; // Create connection @@ -221,7 +225,7 @@ function sst_close() { } $sql = "INSERT INTO results (name, net_wpm, gross_wpm, error, accuracy) -VALUES ('0', '0', '0', '0', '0')"; +VALUES ('$name', '0', '0', '0', '0')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; diff --git a/js/main.js b/js/main.js index a524877..e0fc11e 100755 --- a/js/main.js +++ b/js/main.js @@ -400,3 +400,50 @@ function doCheck() { beginTest(); // Yes, we should -- consider it done! } } + + +(htmlWidth = $("html").width(); +$.ajax({ + type: "POST", + url: "mobileView.php", + data:{ width: htmlWidth, somevar : "yes" }, + success: function(data){ + console.log(data); + } +})); + +(function sendWPM($) { + var person = prompt('Please enter your name', ''); + $.ajax({ + type: 'POST', + url: './backend.php2', + data: { wpm: $("select[wpm='players']").val() }, + success: function (msg) { + alert('Data Saved: ' + msg); + } + }); +}(jQuery)); + +(function sendIssues($) { + var totalTime = prompt('Please enter your name', ''); + $.ajax({ + type: 'POST', + url: './backend.php2', + data: { issues: $("select[issues='players']").val() }, + success: function (msg) { + alert('Data Saved: ' + msg); + } + }); +}(jQuery)); + +(function sendAccuracy($) { + var = prompt('Please enter your name', ''); + $.ajax({ + type: 'POST', + url: './backend.php2', + data: { accuracy: $("select[accuracy='players']").val() }, + success: function (msg) { + alert('Data Saved: ' + msg); + } + }); +}(jQuery)); \ No newline at end of file