Trying to create a counter megabytes. Are being synchronized with the server

Discussion in 'PHP' started by avim1, Jan 13, 2010.

  1. #1
    Hi this my first message, the first thing I really like the forum and my English was not so lousy I was more active. After the introduction I have a problem I'm trying to create a code writer the amount of storage space above it all, all one-byte second. Something like Google. I do not really know how to create such a thing that will always be are being synchronized with the server. Hope for help . thank avi.
     
    avim1, Jan 13, 2010 IP
  2. avim1

    avim1 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What no one knows. I thought it was pretty simple. Well too bad, thank you all anyway.
     
    avim1, Jan 15, 2010 IP
  3. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #3
    I didn't fully understand your question.
    You want to display the amount of space you're using? Or perhaps pageload time?
     
    Sky AK47, Jan 16, 2010 IP
  4. avim1

    avim1 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No, I'm trying to create a counter going up every second, and showing the amount of MB added. Something like the Gmail.
     
    avim1, Jan 16, 2010 IP
  5. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #5
    Yes, okay, the amount of MB of what?
     
    Sky AK47, Jan 17, 2010 IP
  6. avim1

    avim1 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I do not think you understood me, I want to open a hosting service,and giving my customers a few more megabytes every day. The script is just to show them hwo much add to Their account .
     
    avim1, Jan 17, 2010 IP
  7. squishi

    squishi Peon

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I would store the customers' join date in a database and then calculate their storage allowance according to this date.
     
    squishi, Jan 17, 2010 IP
  8. Steve136

    Steve136 Peon

    Messages:
    240
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I understand what you mean, GMail displays the amount of data that it's currently storing (every users) - Go to googlemail.com (not signed in) and look under "Lots of space Over 7413.652697 megabytes (and counting) of free storage." That number counts up every second.

    If you want it updating every second and displaying to the user without a page refresh, you'll want to use Javascript that performs an AJAX request to a PHP script that calculates the size of the users data.

    If you know what you're doing you can easily do this with JQuery and a small PHP function that echos out the size of the directory for a specific user.

    Although if you have a large site and have many users it's not recommended as it'll generate hundreds of extra requests to your server.

    No doubt Google have some sort of caching, i.e. check the size and cache it every 10 minutes and just use a javascript timer to countdown between those numbers (generating less traffic as it's not really real-time) but looks like it is.

    Regards,
    Steve
     
    Steve136, Jan 17, 2010 IP