Add files via upload
This commit is contained in:
parent
2f67e0fe4a
commit
125568e992
8 changed files with 1111 additions and 0 deletions
30
index.html
Normal file
30
index.html
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Typing-Test</title>
|
||||||
|
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Rubik:400,700'><link rel="stylesheet" href="./TypingTest/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="login-form">
|
||||||
|
<form action="./TypingTest/register_login.php" method="post">
|
||||||
|
<h1>Login</h1>
|
||||||
|
<div class="content">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="username" name="username" placeholder="Username" autocomplete="off" required>
|
||||||
|
</div>
|
||||||
|
<div class="input-field">
|
||||||
|
<input id="email" type="email" name="email" placeholder="E-mail" autocomplete="off" required oninput="checkEmail()">
|
||||||
|
</div>
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="password" name="password" placeholder="Password" autocomplete="off" required>
|
||||||
|
</div></div>
|
||||||
|
<div class="action">
|
||||||
|
<button type="submit" name="register" >Register</button>
|
||||||
|
<button type="submit" name="sign-in">Sign in</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<script src="./TypingTest/script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
148
main.php
Normal file
148
main.php
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Speed-Test</title>
|
||||||
|
<script src="./script.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./style.css"/>
|
||||||
|
</head>
|
||||||
|
<body style="background-color:powderblue;">
|
||||||
|
<center><h1 style="color: black;font-size: 50px;margin-bottom: -10px;">TYPING TEST</h1></center>
|
||||||
|
<hr style="margin-bottom: 0px;"/>
|
||||||
|
<hr style="margin-bottom: 0px;"/>
|
||||||
|
<hr/>
|
||||||
|
<br/>
|
||||||
|
<?php
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$query = "SELECT * FROM `users` WHERE id='".$_GET['id']."'";
|
||||||
|
$query = mysqli_fetch_array(mysqli_query($conn, $query));
|
||||||
|
$USERNAME = $query["username"];
|
||||||
|
echo "<script>userid=".$_GET['id']."</script>";
|
||||||
|
?>
|
||||||
|
<div style="text-align: right; margin-bottom: -20px; margin-right: 2%;font-size: 15px;color: blue;">
|
||||||
|
<?php echo "<strong>UserName : ".$USERNAME."</strong>" ?>
|
||||||
|
<?php echo "<h4 onclick='logout()' style='color:red;cursor:grab'>logout</h4>" ?>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top:5%">
|
||||||
|
<div style="background-color: powderblue;color: black;">
|
||||||
|
<center>
|
||||||
|
<h2 style="font-size: 50px;"><b id="main-text-first" style="color: brown"></b><b id="main-text-second">Click on 'START' to start test</b></h2>
|
||||||
|
<?php
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$query = "SELECT `data` FROM `typerdata`";
|
||||||
|
$query = mysqli_query($conn, $query);
|
||||||
|
$checkdata = "";
|
||||||
|
echo "<script>";
|
||||||
|
while($temp = mysqli_fetch_array($query)) {
|
||||||
|
$temp = str_replace("\"","\\\"", $temp['data']);
|
||||||
|
echo 'wholeData.push("'.$temp.'");';
|
||||||
|
$checkdata = $temp;
|
||||||
|
}
|
||||||
|
echo "
|
||||||
|
dataCount = parseInt(Math.random()*10) % wholeData.length;
|
||||||
|
data = wholeData[dataCount % wholeData.length].split(\" \");
|
||||||
|
if (true) {
|
||||||
|
tempData = [];
|
||||||
|
for (let i = 0 ; i < 22/*data.length*/ ; i++) {
|
||||||
|
if (data[i].trim().length != 0){
|
||||||
|
tempData.push(data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempData.push(\" \");
|
||||||
|
tempData.push(\" \");
|
||||||
|
data = tempData;
|
||||||
|
}
|
||||||
|
</script>";
|
||||||
|
?>
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<center>
|
||||||
|
<strong>( YOUR TYPING SPEED IS : </strong><strong id="speed_info">0</strong><strong> words/min)</strong>
|
||||||
|
</center>
|
||||||
|
</div><br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<center><input id="text-test" type="text" size="60" style="color:brown; font-weight: bold; height: 50px; text-align: center; font-size: large;margin-top: -30px;" placeholder="start typing here..." disabled></center>
|
||||||
|
<script>
|
||||||
|
document.getElementById("text-test").value = "";
|
||||||
|
document.getElementById("text-test").disabled = true;
|
||||||
|
</script>
|
||||||
|
</div><br/>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<b>LISTEN AND TYPE</b> 
|
||||||
|
<label class="switch">
|
||||||
|
<input id="listenAndtype_id" type="checkbox">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
            
|
||||||
|
|
||||||
|
<b>IGNORE CASE</b>
|
||||||
|
 
|
||||||
|
<label class="switch">
|
||||||
|
<input id="ignoreCase_id" type="checkbox">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
</center><br/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<center>
|
||||||
|
<strong style="color:blue" id="suggestion"></strong>
|
||||||
|
</center>
|
||||||
|
</div><br/>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<button style="font-size: 20px; border-radius: 20%;background-color: green;border-color: green; width: 100px;
|
||||||
|
display: inline-block;" onclick="start()" id="start-button">Start</button>
|
||||||
|
<button style="font-size: 20px; margin-left: 20px; border-radius: 20%; background-color: red;border-color: red; width: 100px;
|
||||||
|
display: inline-block;" onclick='stop()'>Stop</button>
|
||||||
|
</center>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<input type="checkbox" id="subscribe" onchange="showAlertForSubscribe()">
|
||||||
|
<label for="vehicle1"><b>Subscribe to get latest-updates on your e-mail.</b></label><br>
|
||||||
|
<?php
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$query = "SELECT * FROM `subscribe` WHERE `uid`=".$_GET['id'];
|
||||||
|
$query = mysqli_query($conn, $query);
|
||||||
|
if (mysqli_num_rows($query) > 0) {
|
||||||
|
echo "<script>document.getElementById('subscribe').checked=true;</script>";
|
||||||
|
} else {
|
||||||
|
echo "<script>document.getElementById('subscribe').checked=false;</script>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<h3 style="margin-bottom: 5px;margin-top: 5px;"><u>Best Scores</u></h3>
|
||||||
|
<table id="user_info">
|
||||||
|
<?php
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$query = "SELECT * FROM `bestscores` ORDER BY `scores` DESC";
|
||||||
|
$query = mysqli_query($conn, $query);
|
||||||
|
if (mysqli_num_rows($query) == 0) {
|
||||||
|
echo "null";
|
||||||
|
} else {
|
||||||
|
$i = 0;
|
||||||
|
while($temp = mysqli_fetch_array($query)) {
|
||||||
|
if($i == 5){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$i = $i + 1;
|
||||||
|
$USERNAME = mysqli_fetch_array(mysqli_query($conn, "SELECT `username` from `users` WHERE `id`=".$temp['userid']))['username'];
|
||||||
|
echo "<tr><td>".$USERNAME." </td><td>:</td><td> ".$temp['scores']." words/min</td></tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
44
register_login.php
Normal file
44
register_login.php
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
function checkAndRegister() {
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$query = "SELECT `email` FROM `users` WHERE email='".$_POST["email"]."' AND username='".$_POST["username"]."' AND password='".$_POST["password"]."'";
|
||||||
|
$count = mysqli_num_rows(mysqli_query($conn, $query));
|
||||||
|
|
||||||
|
//checking if user already exits, then send back;
|
||||||
|
if($count > 0) {
|
||||||
|
mysqli_close($conn);
|
||||||
|
echo "<script>alert('user already exits. Please login instead')</script>";
|
||||||
|
echo "<script>history.back()</script>";
|
||||||
|
} else {
|
||||||
|
$query = "INSERT INTO `users` (`username`, `password`, `email`) VALUES ('".$_POST["username"]."', '".$_POST["password"]."', '".$_POST["email"]."')";
|
||||||
|
mysqli_query($conn, $query);
|
||||||
|
$query = "SELECT `id` FROM `users` WHERE email='".$_POST["email"]."' AND username='".$_POST["username"]."' AND password='".$_POST["password"]."'";
|
||||||
|
$query = mysqli_fetch_array(mysqli_query($conn, $query))['id'];
|
||||||
|
mysqli_close($conn);
|
||||||
|
echo "<script>window.location.replace('./main.php?id=".$query."');</script>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAndLogin() {
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$query = "SELECT `email` FROM `users` WHERE email='".$_POST["email"]."' AND username='".$_POST["username"]."' AND password='".$_POST["password"]."'";
|
||||||
|
$count = mysqli_num_rows(mysqli_query($conn, $query));
|
||||||
|
|
||||||
|
if($count == 0) {
|
||||||
|
mysqli_close($conn);
|
||||||
|
echo "<script>alert('Wrong Credentials!!')</script>";
|
||||||
|
echo "<script>history.back()</script>";
|
||||||
|
} else {
|
||||||
|
$query = "SELECT `id` FROM `users` WHERE email='".$_POST["email"]."' AND username='".$_POST["username"]."' AND password='".$_POST["password"]."'";
|
||||||
|
$query = mysqli_fetch_array(mysqli_query($conn, $query))["id"];
|
||||||
|
mysqli_close($conn);
|
||||||
|
echo "<script>window.location.replace('./main.php?id=".$query."');</script>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['register'])) {
|
||||||
|
checkAndRegister();
|
||||||
|
} else if(isset($_POST['sign-in'])) {
|
||||||
|
checkAndLogin();
|
||||||
|
}
|
||||||
|
?>
|
||||||
20
savescore.php
Normal file
20
savescore.php
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$uid = $_GET['uid'];
|
||||||
|
$score = $_GET['score'];
|
||||||
|
$query = "SELECT * FROM `bestscores` WHERE `userid`=".$uid;
|
||||||
|
$query = mysqli_query($conn, $query);
|
||||||
|
if (mysqli_num_rows($query) > 0) {
|
||||||
|
if (mysqli_fetch_array($query)['scores'] < $score ) {
|
||||||
|
$query = "UPDATE `bestscores` SET `scores`=".$score." WHERE `userid`=".$uid;
|
||||||
|
mysqli_query($conn, $query);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$query = "INSERT INTO `bestscores` (`userid`, `scores`) VALUES (".$uid.", ".$score.")";
|
||||||
|
mysqli_query($conn, $query);
|
||||||
|
}
|
||||||
|
echo "<script>
|
||||||
|
window.location.replace('./main.php?id=".$uid."');
|
||||||
|
</script>";
|
||||||
|
mysqli_close($conn);
|
||||||
|
?>
|
||||||
253
script.js
Normal file
253
script.js
Normal file
|
|
@ -0,0 +1,253 @@
|
||||||
|
|
||||||
|
var isfreshStart = true;
|
||||||
|
var wordCount = 0;
|
||||||
|
var qualityType = 0;
|
||||||
|
var timeCounterForSpeed = 0;
|
||||||
|
var speed = 0;
|
||||||
|
var userid = "";
|
||||||
|
var timeCounterForSpeed_pause = false;
|
||||||
|
var msg = new SpeechSynthesisUtterance();
|
||||||
|
var voices = window.speechSynthesis.getVoices();
|
||||||
|
msg.voice = voices[10];
|
||||||
|
msg.voiceURI = "native";
|
||||||
|
msg.volume = 1;
|
||||||
|
msg.rate = 0.8;
|
||||||
|
msg.pitch = 0.8;
|
||||||
|
msg.lang = 'en-US';
|
||||||
|
|
||||||
|
// information about data
|
||||||
|
var wholeData = [];
|
||||||
|
var suggestions = ["Donot use caps lock while typing", "Use the correct positioning of fingers", "Focus on accuracy over speed", "Don’t look at the keyboard or your hands", "Practice, Practice, Practice"];
|
||||||
|
var suggestion_count = 0;
|
||||||
|
var dataCount = 0;
|
||||||
|
var data = "";
|
||||||
|
var pointer_to_data = 1;
|
||||||
|
var firstPartData = "";
|
||||||
|
var secondPartData = "";
|
||||||
|
|
||||||
|
function startTimeCounter() {
|
||||||
|
const timeOut = setInterval(function(){
|
||||||
|
if (isfreshStart) {
|
||||||
|
clearTimeout(timeOut);
|
||||||
|
}
|
||||||
|
if (!timeCounterForSpeed_pause) {
|
||||||
|
timeCounterForSpeed += 1;
|
||||||
|
speed = parseInt(wordCount / (timeCounterForSpeed / 60.0));
|
||||||
|
document.getElementById("speed_info").textContent = speed;
|
||||||
|
qualityType = parseInt(speed/10) % 10;
|
||||||
|
switch (qualityType) {
|
||||||
|
case 0 :
|
||||||
|
case 1 :
|
||||||
|
case 2 :
|
||||||
|
case 3 : document.getElementById("speed_info").style.color = "red"; break;
|
||||||
|
case 4 : document.getElementById("speed_info").style.color = "#D2E101"; break;
|
||||||
|
default : document.getElementById("speed_info").style.color = "green"; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function startSuggestion() {
|
||||||
|
const timeOut = setInterval(function(){
|
||||||
|
if (isfreshStart) {
|
||||||
|
clearTimeout(timeOut);
|
||||||
|
}
|
||||||
|
if (document.getElementById("start-button").innerText == "Pause") {
|
||||||
|
document.getElementById("suggestion").textContent = "( suggestion : " + suggestions[suggestion_count % suggestions.length] + " )";
|
||||||
|
suggestion_count += 1;
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function speak(message) {
|
||||||
|
msg.text = document.getElementById("main-text-second").textContent;
|
||||||
|
if (document.getElementById("listenAndtype_id").checked && (document.getElementById("start-button").innerText == "Pause")) {
|
||||||
|
speechSynthesis.speak(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
if (isfreshStart) { // for the first start
|
||||||
|
secondPartData = data[pointer_to_data - 1] + " " + data[pointer_to_data] + " " + data[pointer_to_data + 1];
|
||||||
|
pointer_to_data = 1;
|
||||||
|
timeCounterForSpeed = 0;
|
||||||
|
wordCount = 0;
|
||||||
|
speed = 0;
|
||||||
|
timeCounterForSpeed_pause = false;
|
||||||
|
startTest();
|
||||||
|
startTimeCounter();
|
||||||
|
startSuggestion();
|
||||||
|
isfreshStart = false;
|
||||||
|
document.getElementById("main-text-second").textContent = firstPartData + secondPartData;
|
||||||
|
document.getElementById("start-button").innerText = "Pause";
|
||||||
|
document.getElementById("start-button").style.backgroundColor = "yellow";
|
||||||
|
document.getElementById("start-button").style.borderColor = "yellow";
|
||||||
|
document.getElementById("text-test").disabled = false;
|
||||||
|
} else if (document.getElementById("start-button").innerText == "Start") {
|
||||||
|
document.getElementById("main-text-second").textContent = firstPartData + secondPartData;
|
||||||
|
document.getElementById("start-button").innerText = "Pause";
|
||||||
|
document.getElementById("start-button").style.backgroundColor = "yellow";
|
||||||
|
document.getElementById("start-button").style.borderColor = "yellow";
|
||||||
|
document.getElementById("text-test").disabled = false;
|
||||||
|
startTest();
|
||||||
|
startTimeCounter();
|
||||||
|
startSuggestion();
|
||||||
|
} else { // when clicked on pause to pause test.
|
||||||
|
timeCounterForSpeed_pause = true;
|
||||||
|
document.getElementById("main-text-first").textContent = "";
|
||||||
|
document.getElementById("main-text-second").textContent = "Click on 'Start' to continue test";
|
||||||
|
document.getElementById("start-button").innerText = "Start";
|
||||||
|
document.getElementById("start-button").style.backgroundColor = "green";
|
||||||
|
document.getElementById("start-button").style.borderColor = "green";
|
||||||
|
document.getElementById("text-test").disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startTest() {
|
||||||
|
var timeCount = 0;
|
||||||
|
var shallEndTheGameAfterSingleWord = false;
|
||||||
|
const timeOut = setInterval(function(){
|
||||||
|
// resetting timeout when reset (stop) is done
|
||||||
|
if (isfreshStart) {
|
||||||
|
clearTimeout(timeOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
// when test is started
|
||||||
|
if (document.getElementById("start-button").innerText == "Pause") {
|
||||||
|
let mainData = document.getElementById("main-text-first").textContent + document.getElementById("main-text-second").textContent;
|
||||||
|
let ansData = document.getElementById("text-test").value.trim();
|
||||||
|
let commonData = "";
|
||||||
|
let temp = 0;
|
||||||
|
for (; temp < ansData.length; temp++) {
|
||||||
|
if((document.getElementById("ignoreCase_id").checked && mainData[temp].toLowerCase() == ansData[temp].toLowerCase()) || ((!document.getElementById("ignoreCase_id").checked) && mainData[temp] == ansData[temp])) {
|
||||||
|
commonData += mainData[temp];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commonData.trim().split(" ").length > 1) {
|
||||||
|
if (pointer_to_data + 2 != data.length) {
|
||||||
|
pointer_to_data += 1;
|
||||||
|
} else {
|
||||||
|
shallEndTheGameAfterSingleWord = true;
|
||||||
|
}
|
||||||
|
document.getElementById("main-text-first").textContent = commonData.trim().split(" ")[commonData.split(" ").length==0 ? 0 : commonData.split(" ").length-1];
|
||||||
|
let temp_data = data[pointer_to_data - 1] + " " + data[pointer_to_data] + " " + data[pointer_to_data + 1];
|
||||||
|
temp_data = temp_data.substring(document.getElementById("main-text-first").textContent.length, temp_data.length);//split(document.getElementById("main-text-first").textContent);
|
||||||
|
// if (true) {
|
||||||
|
// let temp_temp_data = "";
|
||||||
|
// for(let i = 1; i < temp_data.length ; i++)
|
||||||
|
// temp_temp_data += temp_data[i] + " ";
|
||||||
|
// temp_data = temp_temp_data.trim();
|
||||||
|
// }
|
||||||
|
document.getElementById("main-text-second").textContent = temp_data;
|
||||||
|
document.getElementById("main-text-first").style.color = "brown";
|
||||||
|
document.getElementById("text-test").value = commonData.split(" ")[commonData.split(" ").length-1];
|
||||||
|
firstPartData = document.getElementById("main-text-first").textContent + " ";
|
||||||
|
secondPartData = document.getElementById("main-text-second").textContent;
|
||||||
|
document.getElementById("text-test").value = firstPartData.trim();
|
||||||
|
wordCount += 1;
|
||||||
|
} else {
|
||||||
|
if ( commonData.length != 0) {
|
||||||
|
firstPartData = commonData;
|
||||||
|
secondPartData = (document.getElementById("main-text-first").textContent + document.getElementById("main-text-second").textContent).substring(temp, mainData.length);
|
||||||
|
document.getElementById("main-text-first").textContent = firstPartData;
|
||||||
|
document.getElementById("main-text-first").style.color = "brown";
|
||||||
|
document.getElementById("main-text-second").textContent = secondPartData;
|
||||||
|
|
||||||
|
// end game
|
||||||
|
if ( commonData.length == (firstPartData + secondPartData).trim().length) {
|
||||||
|
let message = qualityType < 4 ? "You need to improve your typing speed." : qualityType > 4 ? "Your typing speed is nice. Keep it up" : "Your typing speed is good. Practice more!";
|
||||||
|
alert("game ended! Your Typing speed is " + speed + " words/min.\n" + message);
|
||||||
|
let updateSpeed = speed;
|
||||||
|
stop();
|
||||||
|
window.location.href = './savescore.php?uid=' + userid + "&score=" + updateSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// delay in audio output in repeating
|
||||||
|
timeCount += 1;
|
||||||
|
if (timeCount % 25 == 0) {
|
||||||
|
speak();
|
||||||
|
timeCount = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() { // when stop is clicked, resetting everything
|
||||||
|
var updateSpeed_temp = speed;
|
||||||
|
var qualityType_temp = qualityType;
|
||||||
|
document.getElementById("main-text-first").textContent = "";
|
||||||
|
document.getElementById("main-text-second").textContent = "Click on 'START' to start test";
|
||||||
|
document.getElementById("start-button").innerText = "Start";
|
||||||
|
document.getElementById("start-button").style.backgroundColor = "green";
|
||||||
|
document.getElementById("start-button").style.borderColor = "green";
|
||||||
|
document.getElementById("text-test").value = "";
|
||||||
|
document.getElementById("text-test").disabled = true;
|
||||||
|
document.getElementById("suggestion").textContent = "";
|
||||||
|
pointer_to_data = 1;
|
||||||
|
timeCounterForSpeed_pause = true;
|
||||||
|
isfreshStart = true;
|
||||||
|
wordCount = 0;
|
||||||
|
qualityType = 0;
|
||||||
|
speed = 0;
|
||||||
|
dataCount += 1;
|
||||||
|
data = wholeData[dataCount % wholeData.length].split(" ");
|
||||||
|
tempData = [];
|
||||||
|
for (let i = 0 ; i < 22/*data.length*/ ; i++) {
|
||||||
|
if (data[i].trim().length != 0){
|
||||||
|
tempData.push(data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data = tempData;
|
||||||
|
timeCounterForSpeed = 0;
|
||||||
|
firstPartData = "";
|
||||||
|
secondPartData = data[pointer_to_data - 1] + " " + data[pointer_to_data] + " " + data[pointer_to_data + 1];
|
||||||
|
document.getElementById("speed_info").textContent = 0;
|
||||||
|
document.getElementById("speed_info").style.color = "black";
|
||||||
|
|
||||||
|
// end game
|
||||||
|
if ( updateSpeed_temp != 0) {
|
||||||
|
let message = qualityType_temp < 4 ? "You need to improve your typing speed." : qualityType_temp > 4 ? "Your typing speed is nice. Keep it up" : "Your typing speed is good. Practice more!";
|
||||||
|
alert("game ended! Your Typing speed is " + updateSpeed_temp + " words/min.\n" + message);
|
||||||
|
window.location.href = './savescore.php?uid=' + userid + "&score=" + updateSpeed_temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showAlertForSubscribe() {
|
||||||
|
if (document.getElementById("subscribe").checked) {
|
||||||
|
// alert("Subscribed successfully to get latest-updates.")
|
||||||
|
window.location.href = './subscribe.php?uid=' + userid + '&subs=1';
|
||||||
|
} else {
|
||||||
|
// alert("Unsubscribed successfully!")
|
||||||
|
window.location.href = './subscribe.php?uid=' + userid + '&subs=0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadBestSpeed() {
|
||||||
|
var usernames = ["Ujjwal Kumar", "Niyaz Ahmed Mir", "Bimal"];
|
||||||
|
var speeds = [10, 20, 30];
|
||||||
|
let temp_list = "";
|
||||||
|
for (let i = 0; i < usernames.length; i++) {
|
||||||
|
temp_list += "<tr><td>" + usernames[i] + "</td><td>:</td><td> " + speeds[i] + " words/min</td></tr>";
|
||||||
|
}
|
||||||
|
document.getElementById("user_info").innerHTML = temp_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkEmail() {
|
||||||
|
let email = document.getElementById("email").value;
|
||||||
|
if(!String(email).toLowerCase()
|
||||||
|
.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)) {
|
||||||
|
document.getElementById("email").style.color = "red";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
document.getElementById("email").style.color = "black";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
window.location.replace('../index.html');
|
||||||
|
}
|
||||||
150
speedtest.sql
Normal file
150
speedtest.sql
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 5.2.0
|
||||||
|
-- https://www.phpmyadmin.net/
|
||||||
|
--
|
||||||
|
-- Host: 127.0.0.1
|
||||||
|
-- Generation Time: Mar 04, 2023 at 08:47 PM
|
||||||
|
-- Server version: 10.4.27-MariaDB
|
||||||
|
-- PHP Version: 8.0.25
|
||||||
|
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
START TRANSACTION;
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Database: `speedtest`
|
||||||
|
--
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `bestscores`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `bestscores` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`userid` int(11) NOT NULL,
|
||||||
|
`scores` int(11) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `bestscores`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `bestscores` (`id`, `userid`, `scores`) VALUES
|
||||||
|
(3, 33, 42),
|
||||||
|
(4, 32, 50);
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `subscribe`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `subscribe` (
|
||||||
|
`uid` int(10) NOT NULL,
|
||||||
|
`email` varchar(30) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `subscribe`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `subscribe` (`uid`, `email`) VALUES
|
||||||
|
(33, 'ujjwal@gmail.com');
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `typerdata`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `typerdata` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`data` varchar(1000) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `typerdata`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `typerdata` (`id`, `data`) VALUES
|
||||||
|
(1, 'Once, there was a boy who became bored when he watched over the village sheep grazing on the hillside. To entertain himself, he sang out, \"Wolf! Wolf! The wolf is chasing the sheep!\" When the villagers heard the cry, they came running up the hill to drive the wolf away. But, when they arrived, they saw no wolf. The boy was amused when seeing their angry faces. \"Don\'t scream wolf, boy,\" warned the villagers, \"when there is no wolf!\" They angrily went back down the hill. Later, the shepherd boy cried out once again, \"Wolf! Wolf! The wolf is chasing the sheep!\" To his amusement, he looked on as the villagers came running up the hill to scare the wolf away. As they saw there was no wolf, they said strictly, \"Save your frightened cry for when there really is a wolf! Don\'t cry ‘wolf\' when there is no wolf!\" But the boy grinned at their words while they walked grumbling down the hill once more. Later, the boy saw a real wolf sneaking around his flock. Alarmed, he jumped on his feet and cried'),
|
||||||
|
(2, 'There once was a king named Midas who did a good deed for a Satyr. And he was then granted a wish by Dionysus, the god of wine. For his wish,Midas asked that whatever he touched would turn to gold. Despite Dionysus\' efforts to prevent it, Midas pleaded that this was a fantastic wish, and so, it was bestowed. Excited about his newly-earned powers, Midas started touching all kinds of things, turning each item into pure gold. But soon, Midas became hungry. As he picked up a piece of food, he found he couldn\'t eat it. It had turned to gold in his hand. Hungry, Midas groaned, \"I\'ll starve! Perhaps this was not such an excellent wish after all!\" Seeing his dismay, Midas\' beloved daughter threw her arms around him to comfort him, and she, too, turned to gold. \"The golden touch is no blessing,\" Midas cried.'),
|
||||||
|
(3, 'One day, a fox became very hungry as he went to search for some food. He searched high and low, but couldn\'t find something that he could eat. Finally, as his stomach rumbled, he stumbled upon a farmer\'s wall. At the top of the wall, he saw the biggest, juiciest grapes he\'d ever seen. They had a rich, purple color, telling the fox they were ready to be eaten. To reach the grapes, the fox had to jump high in the air. As he jumped, he opened his mouth to catch the grapes, but he missed. The fox tried again but missed yet again. He tried a few more times but kept failing. Finally, the fox decided it was time to give up and go home. While he walked away, he muttered, \"I\'m sure the grapes were sour anyway\"');
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `users`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `users` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`username` varchar(30) NOT NULL,
|
||||||
|
`password` varchar(30) NOT NULL,
|
||||||
|
`email` varchar(30) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `users`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `users` (`id`, `username`, `password`, `email`) VALUES
|
||||||
|
(32, 'arcon', '12345', 'arcon@gmail.com'),
|
||||||
|
(33, 'Ujjwal', '12345', 'ujjwal@gmail.com');
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for dumped tables
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `bestscores`
|
||||||
|
--
|
||||||
|
ALTER TABLE `bestscores`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `typerdata`
|
||||||
|
--
|
||||||
|
ALTER TABLE `typerdata`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `users`
|
||||||
|
--
|
||||||
|
ALTER TABLE `users`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for dumped tables
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `bestscores`
|
||||||
|
--
|
||||||
|
ALTER TABLE `bestscores`
|
||||||
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `typerdata`
|
||||||
|
--
|
||||||
|
ALTER TABLE `typerdata`
|
||||||
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `users`
|
||||||
|
--
|
||||||
|
ALTER TABLE `users`
|
||||||
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
444
style.css
Normal file
444
style.css
Normal file
|
|
@ -0,0 +1,444 @@
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #e35869;
|
||||||
|
font-family: 'Rubik', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form {
|
||||||
|
background: #fff;
|
||||||
|
width: 500px;
|
||||||
|
margin: 65px auto;
|
||||||
|
display: -webkit-box;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-box-direction: normal;
|
||||||
|
flex-direction: column;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 2px 25px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
.login-form h1 {
|
||||||
|
padding: 35px 35px 0 35px;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
.login-form .content {
|
||||||
|
padding: 35px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.login-form .input-field {
|
||||||
|
padding: 12px 5px;
|
||||||
|
}
|
||||||
|
.login-form .input-field input {
|
||||||
|
font-size: 16px;
|
||||||
|
display: block;
|
||||||
|
font-family: 'Rubik', sans-serif;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 1px;
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px solid #747474;
|
||||||
|
outline: none;
|
||||||
|
-webkit-transition: all .2s;
|
||||||
|
transition: all .2s;
|
||||||
|
}
|
||||||
|
.login-form .input-field input::-webkit-input-placeholder {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.login-form .input-field input::-moz-placeholder {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.login-form .input-field input:-ms-input-placeholder {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.login-form .input-field input::-ms-input-placeholder {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.login-form .input-field input::placeholder {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.login-form .input-field input:focus {
|
||||||
|
border-color: #222;
|
||||||
|
}
|
||||||
|
.login-form a.link {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #747474;
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.login-form .action {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-orient: horizontal;
|
||||||
|
-webkit-box-direction: normal;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.login-form .action button {
|
||||||
|
width: 100%;
|
||||||
|
border: none;
|
||||||
|
padding: 18px;
|
||||||
|
font-family: 'Rubik', sans-serif;
|
||||||
|
cursor: pointer;
|
||||||
|
text-transform: uppercase;
|
||||||
|
background: #e8e9ec;
|
||||||
|
color: #777;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
outline: 0;
|
||||||
|
-webkit-transition: all .3s;
|
||||||
|
transition: all .3s;
|
||||||
|
}
|
||||||
|
.login-form .action button:hover {
|
||||||
|
background: #d8d8d8;
|
||||||
|
}
|
||||||
|
.login-form .action button:nth-child(2) {
|
||||||
|
background: #2d3b55;
|
||||||
|
color: #fff;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
|
.login-form .action button:nth-child(2):hover {
|
||||||
|
background: #3c4d6d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LoginPage */
|
||||||
|
.1_2 {
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
.e1_2 {
|
||||||
|
background-color:rgba(33.00000183284283, 72.00000330805779, 192.00000375509262, 1);
|
||||||
|
width:1280px;
|
||||||
|
height:720px;
|
||||||
|
position:absolute;
|
||||||
|
}
|
||||||
|
.e1_3 {
|
||||||
|
width:1641.5px;
|
||||||
|
height:1083px;
|
||||||
|
position:absolute;
|
||||||
|
left:-362px;
|
||||||
|
top:-1px;
|
||||||
|
}
|
||||||
|
.e1_4 {
|
||||||
|
border-radius:500px;
|
||||||
|
background-color:rgba(38.02176296710968, 78.14297407865524, 201.59277141094208, 1);
|
||||||
|
width:724px;
|
||||||
|
height:724px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:359px;
|
||||||
|
}
|
||||||
|
.e1_5 {
|
||||||
|
border-radius:500px;
|
||||||
|
background-color:rgba(35.56280851364136, 75.24470239877701, 197.34277546405792, 1);
|
||||||
|
width:572px;
|
||||||
|
height:572px;
|
||||||
|
position:absolute;
|
||||||
|
left:76px;
|
||||||
|
top:435px;
|
||||||
|
}
|
||||||
|
.e1_6 {
|
||||||
|
border-radius:500px;
|
||||||
|
background-color:rgba(39.26694095134735, 78.55742543935776, 199.45117592811584, 1);
|
||||||
|
width:438px;
|
||||||
|
height:438px;
|
||||||
|
position:absolute;
|
||||||
|
left:143px;
|
||||||
|
top:502px;
|
||||||
|
}
|
||||||
|
.e1_7 {
|
||||||
|
background-color:rgba(38.02176296710968, 78.14297407865524, 201.59277141094208, 1);
|
||||||
|
width:864px;
|
||||||
|
height:721.5px;
|
||||||
|
position:absolute;
|
||||||
|
left:777.5px;
|
||||||
|
top:0px;
|
||||||
|
}
|
||||||
|
.e1_8 {
|
||||||
|
width:300px;
|
||||||
|
height:398px;
|
||||||
|
position:absolute;
|
||||||
|
left:490px;
|
||||||
|
top:161px;
|
||||||
|
}
|
||||||
|
.e1_9 {
|
||||||
|
width:300px;
|
||||||
|
height:45px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:169px;
|
||||||
|
}
|
||||||
|
.1_10 {
|
||||||
|
border:1px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_10 {
|
||||||
|
width:300px;
|
||||||
|
height:45px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:0px;
|
||||||
|
border-top-left-radius:4px;
|
||||||
|
border-top-right-radius:4px;
|
||||||
|
border-bottom-left-radius:4px;
|
||||||
|
border-bottom-right-radius:4px;
|
||||||
|
}
|
||||||
|
.e1_11 {
|
||||||
|
color:rgba(255, 255, 255, 1);
|
||||||
|
width:84px;
|
||||||
|
height:20px;
|
||||||
|
position:absolute;
|
||||||
|
left:51px;
|
||||||
|
top:13px;
|
||||||
|
font-family:Montserrat;
|
||||||
|
text-align:center;
|
||||||
|
font-size:14px;
|
||||||
|
letter-spacing:0;
|
||||||
|
line-height:px;
|
||||||
|
}
|
||||||
|
.e1_12 {
|
||||||
|
width:20px;
|
||||||
|
height:20px;
|
||||||
|
position:absolute;
|
||||||
|
left:12px;
|
||||||
|
top:13px;
|
||||||
|
}
|
||||||
|
.1_13 {
|
||||||
|
border:1px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_13 {
|
||||||
|
width:13.333332061767578px;
|
||||||
|
height:5px;
|
||||||
|
position:absolute;
|
||||||
|
left:3.3333334922790527px;
|
||||||
|
top:12.5px;
|
||||||
|
}
|
||||||
|
.1_14 {
|
||||||
|
border:1px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_14 {
|
||||||
|
width:6.6666669845581055px;
|
||||||
|
height:6.6666669845581055px;
|
||||||
|
position:absolute;
|
||||||
|
left:6.6666669845581055px;
|
||||||
|
top:2.5px;
|
||||||
|
}
|
||||||
|
.e1_15 {
|
||||||
|
width:300px;
|
||||||
|
height:45px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:234px;
|
||||||
|
}
|
||||||
|
.1_16 {
|
||||||
|
border:1px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_16 {
|
||||||
|
width:300px;
|
||||||
|
height:45px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:0px;
|
||||||
|
border-top-left-radius:4px;
|
||||||
|
border-top-right-radius:4px;
|
||||||
|
border-bottom-left-radius:4px;
|
||||||
|
border-bottom-right-radius:4px;
|
||||||
|
}
|
||||||
|
.e1_17 {
|
||||||
|
color:rgba(255, 255, 255, 1);
|
||||||
|
width:85px;
|
||||||
|
height:20px;
|
||||||
|
position:absolute;
|
||||||
|
left:51px;
|
||||||
|
top:13px;
|
||||||
|
font-family:Montserrat;
|
||||||
|
text-align:center;
|
||||||
|
font-size:14px;
|
||||||
|
letter-spacing:0;
|
||||||
|
line-height:px;
|
||||||
|
}
|
||||||
|
.e1_18 {
|
||||||
|
width:20px;
|
||||||
|
height:20px;
|
||||||
|
position:absolute;
|
||||||
|
left:12px;
|
||||||
|
top:13px;
|
||||||
|
}
|
||||||
|
.1_19 {
|
||||||
|
border:1px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_19 {
|
||||||
|
width:15px;
|
||||||
|
height:9.166666984558105px;
|
||||||
|
position:absolute;
|
||||||
|
left:2.5px;
|
||||||
|
top:9.166666984558105px;
|
||||||
|
}
|
||||||
|
.1_20 {
|
||||||
|
border:1px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_20 {
|
||||||
|
width:8.333333015441895px;
|
||||||
|
height:7.5px;
|
||||||
|
position:absolute;
|
||||||
|
left:5.8333330154418945px;
|
||||||
|
top:1.6666667461395264px;
|
||||||
|
}
|
||||||
|
.e1_21 {
|
||||||
|
width:300px;
|
||||||
|
height:45px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:322px;
|
||||||
|
}
|
||||||
|
.e1_22 {
|
||||||
|
box-shadow:0px 4px 4px rgba(0, 0, 0, 0.30000001192092896);
|
||||||
|
background-color:rgba(255, 255, 255, 1);
|
||||||
|
width:300px;
|
||||||
|
height:45px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:0px;
|
||||||
|
border-top-left-radius:4px;
|
||||||
|
border-top-right-radius:4px;
|
||||||
|
border-bottom-left-radius:4px;
|
||||||
|
border-bottom-right-radius:4px;
|
||||||
|
}
|
||||||
|
.e1_23 {
|
||||||
|
color:rgba(33.00000183284283, 72.00000330805779, 192.00000375509262, 1);
|
||||||
|
width:54px;
|
||||||
|
height:20px;
|
||||||
|
position:absolute;
|
||||||
|
left:123px;
|
||||||
|
top:13px;
|
||||||
|
font-family:Montserrat;
|
||||||
|
text-align:center;
|
||||||
|
font-size:16px;
|
||||||
|
letter-spacing:0;
|
||||||
|
line-height:px;
|
||||||
|
}
|
||||||
|
.e1_24 {
|
||||||
|
color:rgba(255, 255, 255, 1);
|
||||||
|
width:146px;
|
||||||
|
height:20px;
|
||||||
|
position:absolute;
|
||||||
|
left:154px;
|
||||||
|
top:378px;
|
||||||
|
font-family:Montserrat;
|
||||||
|
text-align:center;
|
||||||
|
font-size:16px;
|
||||||
|
letter-spacing:0;
|
||||||
|
}
|
||||||
|
.e1_26 {
|
||||||
|
width:119.38622283935547px;
|
||||||
|
height:97.8512191772461px;
|
||||||
|
position:absolute;
|
||||||
|
left:90px;
|
||||||
|
top:0px;
|
||||||
|
}
|
||||||
|
.1_28 {
|
||||||
|
border:3.7564799785614014px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_28 {
|
||||||
|
width:119.38622283935547px;
|
||||||
|
height:77.4139404296875px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
top:0px;
|
||||||
|
}
|
||||||
|
.e1_29 {
|
||||||
|
background-color:rgba(255, 255, 255, 1);
|
||||||
|
width:27.3311767578125px;
|
||||||
|
height:36.53932189941406px;
|
||||||
|
position:absolute;
|
||||||
|
left:55.61553955078125px;
|
||||||
|
top:19.19873046875px;
|
||||||
|
}
|
||||||
|
.1_30 {
|
||||||
|
border:3.0051798820495605px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_30 {
|
||||||
|
width:11.13446044921875px;
|
||||||
|
height:11.147605895996094px;
|
||||||
|
position:absolute;
|
||||||
|
left:50.7236328125px;
|
||||||
|
top:86.70361328125px;
|
||||||
|
}
|
||||||
|
.1_31 {
|
||||||
|
border:3.0051798820495605px solid rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
.e1_31 {
|
||||||
|
width:11.134475708007812px;
|
||||||
|
height:11.147605895996094px;
|
||||||
|
position:absolute;
|
||||||
|
left:77.94122314453125px;
|
||||||
|
top:86.70361328125px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* The switch - the box around the slider */
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 40px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide default HTML checkbox */
|
||||||
|
.switch input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The slider */
|
||||||
|
.slider {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #ccc;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
left: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
background-color: white;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider {
|
||||||
|
background-color: #2196F3;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus + .slider {
|
||||||
|
box-shadow: 0 0 1px #2196F3;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider:before {
|
||||||
|
-webkit-transform: translateX(26px);
|
||||||
|
-ms-transform: translateX(26px);
|
||||||
|
transform: translateX(26px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rounded sliders */
|
||||||
|
.slider.round {
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider.round:before {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
22
subscribe.php
Normal file
22
subscribe.php
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
$conn = mysqli_connect("localhost", "root", "", "speedtest");
|
||||||
|
$subscribe = $_GET['subs'];
|
||||||
|
$uid = $_GET['uid'];
|
||||||
|
if ($subscribe == 1) {
|
||||||
|
$query = "SELECT `email` from `users` WHERE `id`=".$uid;
|
||||||
|
$query = "INSERT INTO `subscribe` (`uid`, `email`) VALUES (".$uid.", '".mysqli_fetch_array(mysqli_query($conn, $query))['email']."')";
|
||||||
|
mysqli_query($conn, $query);
|
||||||
|
echo "<script>
|
||||||
|
alert('Subscribed successfully to get latest-updates.');
|
||||||
|
window.location.replace('./main.php?id=".$uid."');
|
||||||
|
</script>";
|
||||||
|
} else {
|
||||||
|
$query = "DELETE FROM `subscribe` WHERE `uid`=".$uid;
|
||||||
|
mysqli_query($conn, $query);
|
||||||
|
echo "<script>
|
||||||
|
alert('Unsubscribed successfully!');
|
||||||
|
window.location.replace('./main.php?id=".$uid."');
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
mysqli_close($conn);
|
||||||
|
?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue