Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Adults Warning
guzer
post
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 16.02.2012

Ostrzeżenie: (0%)
-----


Witam

mam stronke napisaną w php i potrzebuje zrobić coś takiego jak adults warning przed wejsciem na strone, tak by akceptacja zapisywala sie w ciasteczkach do 1 sesji przegladarki

mam takie cos

Robię stronę check-it.php

  1. CODE
  2. <?
  3. //Check user agent
  4. $r_explorer = $_SERVER [ 'HTTP_USER_AGENT' ];
  5. if ( ( substr_count ( $r_explorer , 'bot' )== 0 ) and ( substr_count ( $r_explorer , 'yahoo' )== 0 ) and ( $_COOKIE [ 'warning1' ]!= 21 ) ) {
  6. include 'warning-page.php' ;
  7. }
  8. ?>



W index.php strony dla strony głównej dodaje :
  1. CODE
  2. <? include 'check-it.php' ; ?>


Tworzę również warning-page.php
  1. CODE
  2. <?
  3. //Lets Set the cookie
  4. if ( $_GET [ 'myage' ]== "I-Am-Older-Than-18" ) {
  5. $page1 = $_GET [ 'page1' ];
  6. setcookie ( "warning1" , 21 , time ()+ 7200 );
  7. header ( 'Location:' . urldecode ( $page1 )) or die( '<a href="' . urldecode ( $page1 ). '"></a>' );
  8. }
  9. ?>
  10. <!--Now the Html Part- Remove this line please-->
  11. <html>
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  14. <title>ADULT CONTENT WARNING</title>
  15. <link href="mystyle.css" rel="stylesheet" type="text/css">
  16. </head>
  17. <body bgcolor="#000000" style="margin:0px;">
  18. <table cellspacing="0" cellpadding="0" border="0" style="width:100%;height:100%;">
  19. <tr>
  20. <td align="center">
  21. <p><b><font color="#FFFF66" face="Verdana, Arial, Helvetica, sans-serif" size="3">Adult Content Warning !
  22. <br>
  23. <img src="warning.png" width="240" height="80"> <br>
  24. </font></b><br>
  25. <h2>
  26. <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>
  27. </a><br>
  28. <a href="http://www.someothersite.com">Click Here to Leave </a></p>
  29. </td>
  30. </tr>
  31. </table></body></html>

Mam 3 problemy

1. Nie zapisuje mi ciasteczek na 1 sesje
2. Akceptacja jest dziala ale moge przewinąc stronę w dół i widze zawartość strony
3. Napisy o akceptacji jak dam, nie wyswietlaja polskiej czcionki

Bardzo proszę o pomoc

dzieki (IMG:style_emoticons/default/exclamation.gif)

Ten post edytował guzer 22.02.2012, 20:37:03
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
guzer
post
Post #2





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 16.02.2012

Ostrzeżenie: (0%)
-----


Masz może jakis przyklad? To nie strona porno, bardziej galeria zdjęć erotycznych, ale tak czy tak chce mieć ostrzeżenie. Na sam koniec projektu jak bedziecie chcieli dam adres strony

mam takie cos
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <title>Adult Content Warning</title>
  3. .black_overlay{
  4. display: none;
  5. position: absolute;
  6. top: 0%;
  7. left: 0%;
  8. width: 100%;
  9. height: 100%;
  10. background-color: black;
  11. z-index:1001;
  12. -moz-opacity: 0.8;
  13. opacity:.80;
  14. filter: alpha(opacity=80);
  15. }
  16. .white_content {
  17. display: none;
  18. position: absolute;
  19. top: 25%;
  20. left: 25%;
  21. width: 50%;
  22. height: 50%;
  23. padding: 16px;
  24. border: 16px solid orange;
  25. background-color: white;
  26. z-index:1002;
  27. overflow: auto;
  28. }
  29. <script language="Javascript" type="text/javascript">
  30. <!--
  31. function ReadCookie() {
  32. var NameOfCookie="Content";
  33. if(document.cookie.length > 0)
  34. {
  35. begin = document.cookie.indexOf(NameOfCookie+"=");
  36. if(begin != -1)
  37. {
  38. // our cookie was set.
  39. // The value stored in the cookie is returned from the function
  40. begin += NameOfCookie.length + 1;
  41. end = document.cookie.indexOf(";",begin);
  42. if(end == -1) end = document.cookie.length;
  43. content=(document.cookie.substring(begin,end));
  44. if (Content=="Adult")document.location.href='adult-content.html';
  45. }
  46. }
  47. }
  48. function SetCookie(cookieName,cookieValue) {
  49. var today = new Date();
  50. var expire = new Date();
  51. var nDays=365
  52. expire.setTime(today.getTime() + 3600000*24*nDays);
  53. document.cookie = cookieName+"="+escape(cookieValue)
  54. + ";expires="+expire.toGMTString();
  55. }
  56. //-->
  57. </head>
  58. <BODY OnLoad="checkCount()">
  59. <p><a href = "java script:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.displa y='block'">Link to Adult Content</a></p>
  60.  
  61.  
  62. <div id="light" class="white_content">
  63.  
  64. <div>
  65. WARNING: This website contains explicit adult material.
  66. </div>
  67.  
  68. <div>
  69. <!-- Please <u>enter</u> only if you are an adult over the age of 18.<br />(or age 21 in some jurisdiction). -->
  70. You may only enter this Website if you are at least
  71. 18 years of age, or at least the age of majority in the jurisdiction
  72. where you reside or from which you access this Website. If you do not
  73. meet these requirements, then you do not have permission to use the
  74. Website.
  75. </div>
  76.  
  77.  
  78. <p align="center"><a href = "#" onClick="SetCookie('Content','Adult');document.location.href='adult-content.html';">Yes, I'm 18+ years old</a>
  79. &nbsp;&nbsp;&nbsp;
  80. <a href = "java script:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display ='none'">No, I'm not 18+ years old</a></div>
  81. <div id="fade" class="black_overlay"></div></p>
  82. </body>
  83. </html>

Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 23:43