Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: PHP Disguise

  1. #11
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    Sessions are easier to handle and will only last until the user closes the browser = Instant logout / session deletion, however a mixture is good

  2. #12
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Beau View Post
    Nice idea actually, never would have thought of it myself. I'd be using sessions as oppose to cookies however, although that really is just an individual preference I guess.
    Was Danny's idea orig

    And i might make a new version but the admin chooses whether to use sessions or cookies?
    Coming and going...
    Highers are getting the better of me

  3. #13
    Join Date
    Sep 2006
    Location
    Hobart, Australia
    Posts
    593
    Tokens
    0

    Default

    Quote Originally Posted by MrCraig View Post
    Was Danny's idea orig

    And i might make a new version but the admin chooses whether to use sessions or cookies?
    Nah, no point IMO. Only admin feature required would be to change the amount of times one needs to refresh the page.

  4. #14
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Just as a quick rewrite, it would probably be more secure to use sessions for something like this, plus the code can be optimised quite easily.

    For example, this (if java hasn't completely overridden my php ability) should do pretty much the same with less bloat & better readabilty.

    PHP Code:
    <?php
    session_start
    (); // start sessions
     
    //Change these
    $noDisplayMessage =" no site ere ";
    $timesNeeded 3//how many refreshes are needed to view page
    //Don't Change
    if($_SESSION['views']<$timesNeeded//PHP will initialise at zero.
    {
        
    $_SESSION['views']++; //increment sessions counter
        
    die($noDisplayMessage); //die and show message
    }
    ?>
    -include at top of pages

    A possible further optimisation would be to put the code in another file, then u can just include it when ever you need it. Only issue is with sessions as it may conflict if its initialised a second time in the main code... a simple edit would fix that though.
    Last edited by Mentor; 14-12-2007 at 05:53 AM.

  5. #15
    Join Date
    Apr 2006
    Location
    Australia
    Posts
    307
    Tokens
    0

    Default

    Omg awesome script. Good work.

  6. #16
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    This is the one I use to hide sites from teachers at school, own code:
    PHP Code:
    <?php

    ob_start
    ();

    $no "Nothing here.";
    $yes "You're well smart.";

    if(!
    $_COOKIE['views']){
        
    setcookie("views","1");
        die(
    $no);
    }elseif(
    $_COOKIE['views'] == "1"){
        
    setcookie("views","2");
        die(
    $no);
    }elseif(
    $_COOKIE['views'] == "2"){
        
    setcookie("views","3");
        die(
    $no);
    }elseif(
    $_COOKIE['views'] == "3"){
        die(
    $yes);
    }

    ?>
    Last edited by lolwut; 14-12-2007 at 10:55 PM.
    i've been here for over 8 years and i don't know why

  7. #17
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Quote Originally Posted by lolwut View Post
    This is the one I use to hide sites from teachers at school, own code:
    PHP Code:
    <?php

    ob_start
    ();

    $no "Nothing here.";
    $yes "You're well smart.";

    if(!
    $_COOKIE['views']){
        
    setcookie("views","1");
        die(
    $no);
    }elseif(
    $_COOKIE['views'] == "1"){
        
    setcookie("views","2");
        die(
    $no);
    }elseif(
    $_COOKIE['views'] == "2"){
        
    setcookie("views","3");
        die(
    $no);
    }elseif(
    $_COOKIE['views'] == "3"){
        die(
    $yes);
    }

    ?>
    Again, lots of wasted code, you only need one check, not 4 :rolleyes:

    (or 2 if you want the pre final code message to appear o.0)

    The greater than / less than comparisons <> are there for a reason.

  8. #18
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    Quote Originally Posted by 01101101entor View Post
    Again, lots of wasted code, you only need one check, not 4 :rolleyes:

    (or 2 if you want the pre final code message to appear o.0)

    The greater than / less than comparisons <> are there for a reason.
    <?php

    ob_start
    ();

    $no = "Nothing here.";
    $yes = "You're well smart.";

    if
    ($_COOKIE['views'] == "3"){
    echo("$yes");
    }else
    {
    setcookie("views", ++);
    die(
    $no);
    }

    ?>
    Last edited by DeejayMachoo$; 15-12-2007 at 01:18 PM.


  9. #19
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Quote Originally Posted by Oojamaflip View Post
    <?php

    ob_start
    ();

    $no = "Nothing here.";
    $yes = "You're well smart.";

    if
    ($_COOKIE['views'] == "3"){
    echo("$yes");
    }else
    {
    setcookie("views", ++);
    die(
    $no);
    }

    ?>
    A few logical + syntactical errors there.
    ++ requires a variable to add to.
    Secondly, if we assume the cookie set was actually storeing an incriment counted, it would only ever display yes and the final page on the 3rd viewing, then never again after that till the cookie was deleited or expired? Which could be a pain in the ****

  10. #20
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Again, why the hell are you using cookies.
    Sessions are better, plus they are there for the browser session, cookies are there.. until.. a while.

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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