Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Confirmation box

    Hello I have an adult website and I want an "adult message" to be display when people go to my website, something like this: http://www.latincaramelito.zoomshare.com/

    i already tried some codes that i found here but they dont seem to work, the codes are:

    first one:

    <script>
    if (!confirm("Do you want to enter this site?"))
    window.location=history.go(-1)
    </script>

    Second one:

    <html>
    <head>
    <script type="text/javascript">
    var stay=confirm("The following site contains appalling material suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit immediately!")
    if (!stay)
    window.location="http://www.yahoo.com"
    </script>
    </head>
    <body>
    Appalling material here
    </body>
    </html>

    help me plz, thank you

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,018
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    <html>
    <head>
    <script type="text/javascript">
    var stay=confirm("The following site contains disgusting filth suitable only for hopeless sexual inadequates. Please 'ok' to enter, 'cancel' to exit immediately!")
    if (!stay) {
    window.location="http://www.yahoo.com";
    }
    </script>
    </head>
    <body>
    Appalling material here
    </body>
    </html>


    <script>
    if (!confirm("Are you sufficiently depraved to want to enter this sick site?"){
    window.location=history.go(-1);
    }
    </script>
    Last edited by Philip M; 10-21-2006 at 08:36 PM.

  • #3
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help

    Hi Phillip,

    thanks for sharing script code. I have more questions:

    - where tu put code
    <script>
    if (!confirm("Are you sufficiently depraved to want to enter this sick site?"){
    window.location=history.go(-1);
    }
    </script>

    - is it possible to make code to remember user sesion and not to display confirmation box each time at reload and for each separate page?

    Thanks for your help, Boris

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,018
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    Quote Originally Posted by borisvel View Post
    Hi Phillip,

    thanks for sharing script code. I have more questions:

    - where tu put code
    <script>
    if (!confirm("Are you sufficiently depraved to want to enter this sick site?")){
    window.location=history.go(-1);
    }
    </script>

    - is it possible to make code to remember user sesion and not to display confirmation box each time at reload and for each separate page?

    Thanks for your help, Boris
    The script is an alternative to the first one, and redirects the user back to the page last previously visited rather than some other page, here yahoo.com.

    If you want to remember the user's response from one session to another you will need to use a cookie. Cookies have been dealt with a zillion times in this forum. it gets a mite tedious to keep repeating the same thing. One more time:-


    Code:
    <html>
    <head>
    
    <script type="text/javascript">
    function createCookie(name,value,days) {
    if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
    }
    
    function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
    }
    
    function eraseCookie(name) {
    createCookie(name,"",-1);
    }
    
    </script>
    </head>
    And in the body:-

    Code:
    <body>
    <div id = "message"></div>
    
    <script type="text/javascript">
    
    if (readCookie('wroteIt')) {  // if cookie exists
    window.location = "http://www.yahoo.com";  // go directly to the page with disgusting filth
    }
    if(!readCookie('wroteIt')) {  // ask vistior if he wants to see porn
    document.getElementById("message").innerHTML = "You have not visited this site before.";
    var stay = confirm("The following site contains disgusting filth suitable only for hopeless sexual inadequates. Please 'ok' to enter, 'cancel' to exit immediately!")
    if (stay) {
    createCookie('wroteIt', 'OKtoSeeFilth', 365);   // 365 days persistence
    window.location = "http://www.yahoo.com";
    }
    if (!stay) {
    eraseCookie('wroteIt');
    window.location = "http://www.google.com";
    }
    }
    
    
    //eraseCookie('wroteIt');// FOR TEST PURPOSES
    
    </script>
    
    </body>
    </html>
    Last edited by Philip M; 10-31-2010 at 03:56 PM. Reason: Improved


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •