News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Age Verification

Started by iverpectin, September 06, 2023, 08:18:22 PM

Previous topic - Next topic

iverpectin

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>

Basara

Hello.
You have two options to add code to your site: either use the HTML block feature or install an extension from a third party.
https://abantecart.atlassian.net/wiki/spaces/AD/pages/12419073/HTML+Block
https://marketplace.abantecart.com/age_verification

Forum Rules Code of conduct
AbanteCart.com 2010 -