AbanteCart Development > AbanteCart v2.0

Age Verification


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">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Age Verification</title>
        /* 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);
    <!-- 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>

    <!-- Your website content goes here -->

        // 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) {

        // Call the checkAge function when the page loads
        window.onload = checkAge;

You have two options to add code to your site: either use the HTML block feature or install an extension from a third party.


[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod