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!


Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2008
    Location
    England
    Posts
    285
    Tokens
    0

    Default [PHP] Page Loading Time

    I would of posted in the correct section but I can't therefore, logically, I thought I should post here. Sorry if I was incorrect in doing this, if a moderator could please move my topic.

    I noticed how a lot of websites have stat scripts with hit-counters and such, here is something you can add to them. A page loading time script! This will display how long it took them to load the web page they are on.

    First off, you will need to place this right at the top of the page.
    Code:
     <?PHP
            $m_time = explode(" ",microtime()); $m_time = $m_time[0] + $m_time[1];       
            $starttime = $m_time;        
            ?> 
    

    This will start a timing script to time how long it too load the web page.

    Now this is here it calculates how long it took to load the page, this needs to be as far down as possible on you're page.
    Code:
     <?        
            $round = 3;   // Script by Buax from Habbox Forum     
            $m_time = explode(" ",microtime());       
            $m_time = $m_time[0] + $m_time[1];       
            $endtime = $m_time;       
            $totaltime = ($endtime - $starttime);       
            echo "Page loading took:". round($totaltime,$round) ." seconds to load.";       
            ?> 
    

  2. #2
    Join Date
    Nov 2007
    Posts
    753
    Tokens
    0

    Default

    It goes under tutorials pal

    Thanks alot though. +Rep even though it means nothing anymore lol
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


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

    Latest Awards:

    Default

    Hey,

    Nice tutorial and will come in handy, You could of added some more comments to show what everything means though .

    You're right , only mods can move it to the tutorial section , I'll move soon if you get enough good feedback .

  4. #4
    Join Date
    Jan 2008
    Location
    England
    Posts
    285
    Tokens
    0

    Default

    Quote Originally Posted by Forge View Post
    It goes under tutorials pal

    Thanks alot though. +Rep even though it means nothing anymore lol
    Only moderators can move it sadly.

    Thanks for the rep! It doesn't matter. It's the thought that counts.

    Quote Originally Posted by --ss-- View Post
    Hey,

    Nice tutorial and will come in handy, You could of added some more comments to show what everything means though .

    You're right , only mods can move it to the tutorial section , I'll move soon if you get enough good feedback .
    I will do from now on! Didn't think about that. Cheers.

    Ok. Hopefully it'll be worth moving.

  5. #5
    Join Date
    Sep 2007
    Location
    USA
    Posts
    474
    Tokens
    0

    Default

    Nice Buax
    *Vote to Tutorials*
    this could be quite a help to everyone

    Also:
    i was wondering why the tutorials section was so old silly hxf needs to let users post tuts
    Post Meter
    ______________________________________________
    400 450 500 550 600 650 700 750 800 850 900-1k
    Green=Done | Orange=Almost | Red=Not Done
    ______________________________________________
    Habbo fury Coming Soon!
    My Img tag has ran away

  6. #6
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    Page loading took:1204672157.39 seconds to load. Messed Up
    Page loaded in 0.59 Seconds
    is that a bad load time?
    Last edited by Colin-Roberts; 04-03-2008 at 11:31 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  7. #7
    Join Date
    Jan 2008
    Location
    England
    Posts
    285
    Tokens
    0

    Default

    Quote Originally Posted by Colin-Roberts View Post
    Page loading took:1204672157.39 seconds to load. Messed Up
    How many lines is you're page you tested it on? It bases it the web-browser reading though the script which is why you need to place the end-timer at the end when it's read though the file etc.

    Don't really know how to fix it for you, worked fine in all of my tests so. Sorry I guess. If you could test it on a small-page, just like 10-50 lines of script or whatever I'd be thankful.

  8. #8
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    Theres no way it took 20 077 869 minutes to load my page. Your script has a part wrong with it.

    <?php $load = microtime();
    print (number_format($load,2));
    ?>

    Short & Sweet
    Last edited by Colin-Roberts; 04-03-2008 at 11:35 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  9. #9
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    PHP Code:
    function do_microtime$microtime )
        {
            if( list( 
    $ms$s ) = explode" "$microtime ) )
            {
                return( (float)
    $ms + (float)$s );
            }
            else
            {
                return 
    $microtime;
            }
        } 
    i use that then just do $time = do_microtime( microtime() );


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

Posting Permissions

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