Question:
How to create an Adult Content "warning" page using PHP?
anonymous
2012-05-13 16:42:51 UTC
I need a PHP script that would redirect users to a Warning page to 'warn' them that there is adult content on the website. After they clicked "enter", I would like it to resume to the original page they were trying to access.

The problem is, I know very little about PHP.

Any help?
Four answers:
anonymous
2012-05-14 12:52:09 UTC
There are many ways to do this but in summary here's how you do it in php...



1. You need to set a cookie when the person visits your site. I make a file called cookie.php and put this bit of code in it.




if (!isset($_COOKIE['allowed'])) {

header("Location:http://www.somesite.com/index.php?request=$_SERVER['REQUEST_URI']");

}

?>



Then I use an include at the top off all my pages.... put this at the very top


2. At the front page, set the pass along the page requested, set the cookie, and create an Enter link to the page originally requested... the following code would go at the very top of the page.






// change to your domain name.

$domain = "youdomain.com";



// Get the requested page, add it to our domain so we can create an enter link

if (isset($_GET['request'])) {

$request ="";

}



// Set a cookie so we are not redirected back here again. You can set how long the cookie is good.

if (!isset($_COOKIE['allowed'])) {

setcookie('allowed','true',time()+604800,'/','.' . $domain);

}



?>



3. Place this where you want your enter button to be. Enter Here






I see after writing it all out, yahoo is cutting some of the code off. Search for swingermoney and I'll email you the code.
J0nny3
2012-05-13 17:03:44 UTC
why not use a pop up like this, its much quicker than doing redirects..



http://www.jquerypopup.com/demo.php



and have it automatically appear when the page is opened. the demo shows a transparent backgaround but you could modify the opacity so that nothing behind the pop up is visible until the user agrees, and then it closes..



the only issue with things like this is that it can get annoying for regular users, so you should use cookies so it only displays once.. or go the PHP route and use an if statement on the page along the lines of...



if the pop up has already been viewed by the user then... dont display it.. else, display the pop up....



you would need to store their IP addresses's in a mysql to recognise which user has or hasnt seen the pop up... but using cookies is a easier solution
?
2012-05-13 16:53:54 UTC
Sure is lots of help.

Is like and AJAX, or can be used with it, or Ruby. I prefer Ruby Gems.

The links provided are some Manuals that are free to use.
anonymous
2016-02-23 00:59:57 UTC
test editor is simple .. u just need a textbox with some width and height. I think u are looking for rich text editor with html tags.. am i ryt? just google it u can find ready made modules about it.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...