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 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Errm..

  1. #1
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default Errm..

    For some reason today I know have this error alot on my site:

    Warning: Division by zero in /home/habfancl/public_html/index.php on line 199

    And my hit counter dont work :S

    Line 199:

    PHP Code:
    $percentage=($uptime/$days) * 100
    Hit counter code:

    PHP Code:
    <?php

    $path 
    "images/";
    $ext ".gif";
    $file "counter.dat";

    $file_array file($file);
    $hits $file_array[0];
    $hits++;

    $fp fopen($file"w");
    fputs($fp$hits);
    fclose($fp);


    for ( 
    $i 0$i <= 9$i++ ) {
    $hits str_replace($i"<img src=\"$path$i$ext\" alt=\"$i\" />"$hits);
    }

    echo 
    $hits;

    ?>

  2. #2
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Tomdarkness2
    PHP Code:
    $percentage=($uptime/$days) * 100
    The uptime or days are zero?

    Use this for your counter:
    PHP Code:
    <?PHP
    $viewsfile 
    file('hits.txt'); //Hits text file name
    $views $viewsfile[0]; 
    if (
    $views != 0

    $views++; 
    $open fopen('hits.txt''w'); //Hits text file name
    fwrite($open$views); 
    fclose($open); 

    else 
    {
    echo 
    'An error occurred. Please check the value of your hits text file is not zero or lower.';
    exit;
    }; 
    echo 
    $views;
    ?>
    kinda quit.

  3. #3
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Nets
    The uptime or days are zero?

    Use this for your counter:
    PHP Code:
    <?PHP
    $viewsfile 
    file('hits.txt'); //Hits text file name
    $views $viewsfile[0]; 
    if (
    $views != 0

    $views++; 
    $open fopen('hits.txt''w'); //Hits text file name
    fwrite($open$views); 
    fclose($open); 

    else 
    {
    echo 
    'An error occurred. Please check the value of your hits text file is not zero or lower.';
    exit;
    }; 
    echo 
    $views;
    ?>
    I want images though

  4. #4
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Tomdarkness2
    I want images though
    Well you could use the code Nets gave you and have a look at GD if you want images so bad ;P

    www.php.net/gd

  5. #5
    Join Date
    Jun 2005
    Location
    Manchester
    Posts
    3,187
    Tokens
    0

    Latest Awards:

    Default

    Exactly.

    Use a GD too display it. But Nets script looks ok.

    - Dan

  6. #6
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Nets your script dont work :S I have cmoded the files to 777 but it still dont work. It displays but wont increase.

  7. #7
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    I gotta try out GD one of these days



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  8. #8
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Tomdarkness2
    Nets your script dont work :S I have cmoded the files to 777 but it still dont work. It displays but wont increase.
    Put the number as 1 to start with, it doesn't do anything if it is 0 so that it doesn't write over the file with 0 if the file didn't load.
    kinda quit.

  9. #9
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Nets
    Put the number as 1 to start with, it doesn't do anything if it is 0 so that it doesn't write over the file with 0 if the file didn't load.
    But i dont want it as 1 i want it as 10578 witch it is set as.

  10. #10
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Tomdarkness2
    But i dont want it as 1 i want it as 10578 witch it is set as.
    Erm it should work fine if you type in 10578..
    kinda quit.

Page 1 of 2 12 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
  •