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
kiler129
post
Post #2





Grupa: Zarejestrowani
Postów: 566
Pomógł: 35
Dołączył: 21.06.2006

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


Jako przykład podam moją małą tabliczkę ostrzeżeniową dla userów IE6:
Kod
<script type="text/javascript">if(document.cookie.indexOf("_die") == -1) { document.write("<style>#_die2 a { text-decoration: none; color: #05A; } #_die2 td { width: 118px; height: 121px; vertical-align:top; font-size: 8pt; text-align:center; }</style><div id=\"_die1\" style=\"width:100000px; height:100000px; background-color:white; position:absolute; top:0px; left:0px; z-index:9999998; display:none;\"></div><div id=\"_die2\" style=\"width: 750px; margin: auto; background-color: #FFF; left: 50%; top:50%; margin-left: -380px; margin-top:-150px; position: absolute; font-family: 'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,sans-serif; font-size: 10pt; color: gray; padding: 10px; border: 1px solid #CCC; z-index:9999999;\"><div style=\"font-size: 14pt; padding: 13px 0 13px 0; color: black;\">Czy wiesz, że twój Internet Explorer wymaga aktualizacji?</div><span>Przeglądarka którą używasz liczy sobie już 10 lat - w świecie informatyki to cała wieczność.<br/>Twoja przeglądarka musi zostać zaktualizowana do nowszej wersji aby bezpiecznie i szybko przeglądać internet.<br/><b>Poniżej znajduje się lista najpopularniejszych przeglądarek które możesz pobrać za darmo.</b><br><br>Kliknij na ikonę aby przejść do strony producenta.<br><br></span><table align=\"center\"><tbody><tr><td><a href=\"http://www.google.com/chrome\" target=\"_blank\"><img src=\"http://noFlash.pl/_die/chrome.gif\" /><br>Google Chrome</a></td><td><a href=\"http://www.getfirefox.com\" target=\"_blank\"><img src=\"http://noFlash.pl/_die/ff.gif\" /><br>Firefox</a></td><td><a href=\"http://www.microsoft.com/windows/Internet-explorer/default.aspx\" target=\"_blank\"><img src=\"http://noFlash.pl/_die/die.gif\" /><br>Internet Explorer</a></td><td><a href=\"http://www.opera.com/download/\" target=\"_blank\"><img src=\"http://noFlash.pl/_die/opera.gif\" /><br>Opera</a></td><td><a href=\"http://www.apple.com/safari/download/\" target=\"_blank\"><img src=\"http://noFlash.pl/_die/safari.gif\" /><br>Safari</a></td></tr></tbody></table><br/><br/><center><button onClick=\"document.getElementById('_die2').style.display = 'none'; document.cookie = '_die=1'\" style=\"font-size:2em;\">Zamknij</button></center></div>"); }


W środku owego document.write jest taki oto kod css+html:
Kod
<style>
#_die2 a { text-decoration: none; color: #05A; } #_die2 td { width: 118px; height: 121px; vertical-align:top; font-size: 8pt; text-align:center; }
</style>
<div id='"_die1"' style='"width:100000px;' height:100000px; background-color:white; position:absolute; top:0px; left:0px; z-index:9999998; display:none;">
</div>
<div id='"_die2"' style='"width:' 750px; margin: auto; background-color: #fff; left: 50%; top:50%; margin-left: -380px; margin-top:-150px; position: absolute; font-family: 'lucida grande','lucida sans unicode',arial,verdana,sans-serif; font-size: 10pt; color: gray; padding: 10px; border: 1px solid #ccc; z-index:9999999;">
    <div style='"font-size:' 14pt; padding: 13px 0 13px 0; color: black;">
        Czy wiesz, że twój Internet Explorer wymaga aktualizacji?
    </div>
    <span>Przeglądarka którą używasz liczy sobie już 10 lat - w świecie informatyki to cała wieczność.<br/>Twoja przeglądarka musi zostać zaktualizowana do nowszej wersji aby bezpiecznie i szybko przeglądać internet.<br/><b>Poniżej znajduje się lista najpopularniejszych przeglądarek które możesz pobrać za darmo.</b><br>
    <br>
    Kliknij na ikonę aby przejść do strony producenta.<br>
    <br>
    </span>
    <table align='"center"'>
    <tbody>
    <tr>
        <td>
            <a href='"http://www.google.com/chrome"' target='"_blank"'><img src='"http://noFlash.pl/_die/chrome.gif"'/><br>
            Google Chrome</a>
        </td>
        <td>
            <a href='"http://www.getfirefox.com"' target='"_blank"'><img src='"http://noFlash.pl/_die/ff.gif"'/><br>
            Firefox</a>
        </td>
        <td>
            <a href='"http://www.microsoft.com/windows/Internet-explorer/default.aspx"' target='"_blank"'><img src='"http://noFlash.pl/_die/die.gif"'/><br>
            Internet Explorer</a>
        </td>
        <td>
            <a href='"http://www.opera.com/download/"' target='"_blank"'><img src='"http://noFlash.pl/_die/opera.gif"'/><br>
            Opera</a>
        </td>
        <td>
            <a href='"http://www.apple.com/safari/download/"' target='"_blank"'><img src='"http://noFlash.pl/_die/safari.gif"'/><br>
            Safari</a>
        </td>
    </tr>
    </tbody>
    </table>
    <br/><br/><center><button onclick='"document.getElementById('_die2').style.display' ='' 'none'; document.cookie ='' '_die='1'"' style='"font-size:2em;"'>Zamknij</button></center>
</div>


Proste do bólu aby zajmowało jak najmniej (IMG:style_emoticons/default/wink.gif)

Ten post edytował kiler129 23.02.2012, 14:03:55
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: 27.12.2025 - 23:43