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 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: PHP Disguise

  1. #21
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice, View Post
    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.
    I did actually post a session using version of the script as an example, a few posts up :p

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

    Latest Awards:

    Default

    Sorry, wasn't aimed at you I saw it the other day.

    I just seem him contining to post using cookies

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

    Default

    Sessions > Cookies. Nuff said

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

    Latest Awards:

    Default

    Quote Originally Posted by Beau View Post
    Sessions > Cookies. Nuff said
    and well said.

  5. #25
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Quote Originally Posted by Beau View Post
    Sessions > Cookies. Nuff said
    Not really, it kinda depends on what your trying to do, remembering a users login details for instance is a task cookies easily > sessions for instance.

    Both are better at different things, the skill is to use the right one for the right purposes

  6. #26
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by 01101101entor View Post
    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.
    Is there a way of having it like danny had a 'panic button' where if you clicked/ refreshed the page it will show the not available message , and if you refreshed again it will show the site contents?
    I'm guessing it can be done by having it so on the 3rd refresh it changes it back to 1 refresh and it keeps going in a loop?

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

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    Is there a way of having it like danny had a 'panic button' where if you clicked/ refreshed the page it will show the not available message , and if you refreshed again it will show the site contents?
    I'm guessing it can be done by having it so on the 3rd refresh it changes it back to 1 refresh and it keeps going in a loop?
    or have a special condition added.
    Say on the page theres a link called panic.
    The link points to whateverpagethisison.php?a=panic

    Now with this code that would reset the refresh counters and load the first page

    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($GET_['a']=="panic"// if panic button hit
    {
       
    $_SESSION['views'] = -1// set views counter to zero
       
    header("Location: ".$_SERVER['PHP_SELF']) ; // reload page
    }
    elseif(
    $_SESSION['views']<$timesNeeded//PHP will initialise at zero.
    {
        
    $_SESSION['views']++; //increment sessions counter
        
    die($noDisplayMessage); //die and show message
    }
    ?>
    (bin doin Java to long, cant remember if phps else if is joint or not. if im wrong add a space in there 2 fix)

  8. #28
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by 01101101entor View Post
    or have a special condition added.
    Say on the page theres a link called panic.
    The link points to whateverpagethisison.php?a=panic

    Now with this code that would reset the refresh counters and load the first page

    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($GET_['a']=="panic"// if panic button hit
    {
       
    $_SESSION['views'] = -1// set views counter to zero
       
    header("Location: ".$_SERVER['PHP_SELF']) ; // reload page
    }
    elseif(
    $_SESSION['views']<$timesNeeded//PHP will initialise at zero.
    {
        
    $_SESSION['views']++; //increment sessions counter
        
    die($noDisplayMessage); //die and show message
    }
    ?>
    (bin doin Java to long, cant remember if phps else if is joint or not. if im wrong add a space in there 2 fix)
    Its joint.

Page 3 of 3 FirstFirst 123

Posting Permissions

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