I see that the last time this came up was 2014, so here we go again.
I asked chatgpt to create some code for this thing and got this: Question is where to put it.. LOL. indexPHP?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Age Verification</title>
<style>
/* CSS for the overlay */
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
align-items: center;
justify-content: center;
}
/* CSS for the popup */
.popup {
background-color: #fff;
padding: 20px;
border-radius: 5px;
text-align: center;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body>
<!-- Age verification overlay -->
<div class="overlay" id="ageVerification">
<div class="popup">
<h2>You must be over 21 to access this content.</h2>
<button onclick="closePopup()">OK</button>
</div>
</div>
<!-- Your website content goes here -->
<script>
// JavaScript function to display the age verification popup
function showPopup() {
var overlay = document.getElementById('ageVerification');
overlay.style.display = 'flex'; // Display the overlay
}
// JavaScript function to close the age verification popup
function closePopup() {
var overlay = document.getElementById('ageVerification');
overlay.style.display = 'none'; // Hide the overlay
}
// Check the user's age (you should replace this with your own logic)
function checkAge() {
var userAge = 21; // Replace with the actual user's age
if (userAge < 21) {
showPopup();
}
}
// Call the checkAge function when the page loads
window.onload = checkAge;
</script>
</body>
</html>