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?");
}
?>