Add php connection to register the user in database with input id="uname" here in sample code below. the database name is: Poknat, Password: 1234, localhost. insert into database table name USER, the date created the account with 0 initialization for total_usage_time and the time and date when the user last used the program. if user already exist update its total_usage_time and the date_last_used. This program aim to track the user total usage of this program.
Code snipet:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome Kids</title>
<link rel="shortcut icon" href="src/icon.png" type="image/x-icon">
</head>
<style>
body {
background-image: url(src/introg.gif);
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: cover;
overflow: hidden;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
}
table {
margin: 0 auto;
border-collapse: collapse;
width: 100%;
height: 100%;
font-size: 100px;
}
td {
width: 100px;
text-align: center;
}
Media screen and (max-width: 600px) {
table, tr, td {
display: block;
}
td {
width: 100%;
}
}
.center {
position: absolute;
width: 100%;
top: 270px;
height: 480px;
}
.play, label {
font-family: 'Moon Kids Personal Use', cursive;
}
.button-75 {
background-color: #ff797900;
border: 0;
border-radius: 10px;
color: #fff;
cursor: pointer;
font-size: 80px;
font-weight: bolder;
height: 54px;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
letter-spacing: .4px;
line-height: 1;
padding-top: 3px;
text-decoration: none;
font-family: 'Moon Kids Personal Use', cursive;
}
.button-75:active {
outline: 0;
}
.button-75:hover {
outline: 0;
}
.button-75 span {
-webkit-transition: all 150ms;
-o-transition: all 150ms;
transition: all 150ms;
}
.button-75:hover span {
-webkit-transform: scale(.9);
-ms-transform: scale(.9);
transform: scale(.9);
opacity: .75;
}
.text {
display: inline-block;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin-inline: auto;
}
</style>
<body>
<div class="center">
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td class="play"><Button class="button-75" onclick="openModal()"><span class="text">Play</span></Button></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
<link rel="stylesheet" href="modal/style.css">
<div id="modal" class="modal">
<div class="modal-content">
<form id="pinform">
<span class="close">×</span><center><span class="picwel">
<img src="src/waving.gif" alt="admin"></span></center><br>
<label for="uname">What's your name?</label>
<input type="text" id="uname" name="uname" required autocomplete="off"/>
<input type="button" class="button" value="Submit" onclick="document.location.href='welcome.html'" />
</form>
</div>
</div>
</body>
<script>
// Function to open the modal
function openModal() {
document.getElementById("modal").style.display = "block";
}
// Function to close the modal
function closeModal() {
document.getElementById("modal").style.display = "none";
}
// Wait for the DOM content to load
document.addEventListener("DOMContentLoaded", function() {
// Close the modal when the close button is clicked
document.querySelector(".close").addEventListener("click", function() {
closeModal();
});
// Close the modal when clicking outside the modal
window.addEventListener("click", function(event) {
if (event.target == document.getElementById("modal")) {
closeModal();
}
});
document.getElementById("uname").addEventListener("submit", function(event) {
event.preventDefault();
const pin = document.getElementById("uname").value;
window.location.href = "easy.html";
});
});
</script>
</html>