Może ktoś byłby w stanie to napisac?
Dla wprawionego to pewnie 5 min pracy, dla laika dluuuuuga droga.
Patrzyłem co nieco na zapisywanie w cookies, ale wyglada co przynajmniej odstraszajaco;/
Edit:
Mam coś takiego:
Robię stronę check-it.php
CODE
<?
//Check user agent
$r_explorer = $_SERVER [ 'HTTP_USER_AGENT' ];
if ( ( substr_count ( $r_explorer , 'bot' )== 0 ) and ( substr_count ( $r_explorer , 'yahoo' )== 0 ) and ( $_COOKIE [ 'warning1' ]!= 21 ) ) {
include 'warning-page.php' ;
}
?>
W index.php strony, na której chce umieścić ostrzeżenie:
CODE
<? include 'check-it.php' ; ?>
Tworzę również warning-page.php
CODE
<?
//Lets Set the cookie
if ( $_GET [ 'myage' ]== "I-Am-Older-Than-18" ) {
$page1 = $_GET [ 'page1' ];
setcookie ( "warning1" , 21 , time ()+ 7200 );
header ( 'Location:' . urldecode ( $page1 )) or die( '<a href="' . urldecode ( $page1 ). '"></a>' );
}
?>
<!--Now the Html Part- Remove this line please-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ADULT CONTENT WARNING</title>
<link href="mystyle.css" rel="stylesheet" type="text/css">
</head>
<body>
<script LANGUAGE="javascript">
<!--
function Info()
{if (!confirm("Strona tylko dla osob 18 +!"))
history.go(-1);return " "}
document.writeln(Info())
<!--End-->
</script></body></html>
I po tym ostatnim zupełnie traci sens, tj nie zapamiętuje cookies.
W oryginale ta ostatnia część wygląda tak:
CODE
<?
//Lets Set the cookie
if ( $_GET [ 'myage' ]== "I-Am-Older-Than-18" ) {
$page1 = $_GET [ 'page1' ];
setcookie ( "warning1" , 21 , time ()+ 7200 );
header ( 'Location:' . urldecode ( $page1 )) or die( '<a href="' . urldecode ( $page1 ). '"></a>' );
}
?>
<!--Now the Html Part- Remove this line please-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ADULT CONTENT WARNING</title>
<link href="mystyle.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000000" style="margin:0px;">
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;height:100%;">
<tr>
<td align="center">
<p><b><font color="#FFFF66" face="Verdana, Arial, Helvetica, sans-serif" size="3">Adult Content Warning !
<br>
<img src="warning.png" width="240" height="80"> <br>
</font></b><br>
<h2>
<a href="warning-page.php?myage=I-Am-Older-Than-18&page1= <?=urlencode ( $_SERVER [ 'REQUEST_URI' ]) ?> "><font style="font-size:20px; font-family:'Verdana '; color:red"><b>Click Here if You are older than 18 Years Old</b></font><br>
</a><br>
<a href="http://www.someothersite.com">Click Here to Leave </a></p>
</td>
</tr>
</table></body></html>
z tym, że wtedy wyświetla mi się to na index.php,
nie odklikując nic można przeglądać zawartość.
Może teraz jakaś pomoc?