elena71pa Posted October 20, 2022 Share Posted October 20, 2022 (edited) Good morning, given that I don't know how to program in php, I'll tell you what I'm looking for. I have a web space where I uploaded a php script, it's an adult site, currently in maintenance mode. I searched on the internet for a code that allows me to display a popup or in any case a pre-entry page in which the user is asked to accept or not the contents of the site, but I have not succeeded in the enterprise. Had it been a Wordpress site, I would have solved it with a plugin, but it isn't. If anyone knew a script or code to implement on the site, could you suggest it to me? Thanks a lot to everyone. (Google Translator) I had found this by browsing the internet, but it doesn't work well, or rather, it shows me the age verification page and makes me enter or exit the site based on the choice, but then it creates problems with the links of the admin panel of the site for example, they don't work. I entered this in the site index: //Start the session session_start(); /* * If they haven't passed the age test * then the age_verified session will not * be set, since it is only set if they * say they are 21 years of age. */ if(!isset($_SESSION['age_verified'])){ header("Location: verify.php"); exit; } This is the verification page: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Nuova pagina 1</title> </head> <body style="background-attachment: fixed" text="#FFFFFF" bgcolor="#CC0099"> <h2 style="text-align: center;"></h2> <h2 style="text-align: center;"> </h2> <h2 style="text-align: center;"> </h2> <h2 style="text-align: center;"> <font color="#FFFFFF" face="Cooper Std Black" size="6"><strong>ATTENZIONE!!</strong></font></h2> <h3 style="text-align: center;"> <font color="#FFFFFF" face="Calibri Light" style="font-size: 16pt"><strong>Questo sito contiene immagini e contenuti rivolti ad un pubblico adulto ed è accessibile solo a persone che abbiano raggiunto la maggiore età prevista dalla legge dal Paese dal quale si accede al sito.</strong></font></h3> <h3 style="text-align: center;"> <font color="#FFFFFF" face="Calibri Light" style="font-size: 16pt"><strong>Gli inserzionisti devono rispettare i nostri standard di età e contenuti nei propri annunci.</strong></font></h3> <h3 style="text-align: center;"> <font color="#FFFFFF" face="Calibri Light" style="font-size: 16pt"><strong>MioSito ha una politica di tolleranza zero nei confronti della pornografia infantile, della pedofilia e nei confronti dei minori che tentassero di pubblicizzarsi attraverso il nostro sito. Qualsiasi attività riguardante tali reati verrà denunciata alle autorità competenti.</strong></font></h3> <h3 style="text-align: center;"> <font color="#FFFFFF" face="Calibri Light" style="font-size: 16pt"><strong>Accedendo a questo sito Web, dichiari di essere maggiorenne e di accettare le Condizioni d'uso e di esonerare MioSito da qualsiasi responsabilità derivante dall'uso del sito.</strong></font></h3> <h3 style="text-align: center;"> <center><form method="POST" action="/ageCheck.php"> <input type="submit" name="valid_age" value="HO 18 ANNI" /> <input type="submit" name="invalid_age" value="Ho Meno di 18 Anni" /> </form></center> </body> </html> Questo è ageCheck.php: <?php //Start session session_start(); /* * First, we want to make sure they came to this ageCheck.php via a form. * Then we can check to see if $_POST['valid_age'] is set, since it will only * be set if they pressed the "I'm 21" button. */ if(isset($_POST)){ if(isset($_POST['valid_age'])){ /* * Since they got here, it means they are of the right age. * Now we set the session value. */ $_SESSION['age_verified'] = true; header("Location: index.php"); exit; }else{ /* * To young! Just re-direct them to Google. */ header("Location: http://www.google.com"); exit; } }else{ die("Trying to sneak in are we?"); } ?> Edited October 20, 2022 by requinix less spammy title Quote Link to comment https://forums.phpfreaks.com/topic/315442-adult-content-acceptance-popup-before-viewing-the-site/ Share on other sites More sharing options...
requinix Posted October 20, 2022 Share Posted October 20, 2022 So you know, titling your thread "Adult Content" is a great way to get an admin's immediate attention - and not in a good way. So I've edited in something for you that's a little more specific. 43 minutes ago, elena71pa said: I had found this by browsing the internet, but it doesn't work well, or rather, it shows me the age verification page and makes me enter or exit the site based on the choice, but then it creates problems with the links of the admin panel of the site for example, they don't work. What kind of problems? Quote Link to comment https://forums.phpfreaks.com/topic/315442-adult-content-acceptance-popup-before-viewing-the-site/#findComment-1601799 Share on other sites More sharing options...
elena71pa Posted October 20, 2022 Author Share Posted October 20, 2022 I click on the menu links, but they don't open Quote Link to comment https://forums.phpfreaks.com/topic/315442-adult-content-acceptance-popup-before-viewing-the-site/#findComment-1601803 Share on other sites More sharing options...
requinix Posted October 20, 2022 Share Posted October 20, 2022 What menu links? I don't see anything in there that looks like a menu. Quote Link to comment https://forums.phpfreaks.com/topic/315442-adult-content-acceptance-popup-before-viewing-the-site/#findComment-1601813 Share on other sites More sharing options...
elena71pa Posted October 20, 2022 Author Share Posted October 20, 2022 the first part of the code I have inserted in the index.php of the script, the other two files, verification and ageCheck are all on the server together with the other files of the script. When I log in to my site, the age selection screen appears, but then I can no longer navigate the site. The site is currently not online but under maintenance. ""An extra thing for the moderators, why don't I receive notifications of replies in my email, even though I have set up to receive them?"" Quote Link to comment https://forums.phpfreaks.com/topic/315442-adult-content-acceptance-popup-before-viewing-the-site/#findComment-1601814 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.