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 7 of 7
  1. #1
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default Download Counter

    I've just made this download counter, to make it work, all you have to do is make a blank counter.txt and CHMOD it to 777. This ups the number in counter.txt and then redirects you to the file you wanted to download.

    PHP Code:
    <?php
    $filename 
    "counter.txt"/* Set variable "$filename" as counter.txt */
    $handle fopen($filename"r+"); /* Sets the $handle variable to open the "$filename" variable */
    $nexturl "http://www.technoteens.net/Habbox%20Baby.mp3"/* Sets the URL to go to after counting */
    $line fgets($handle20); /* Gets the first line from the file */
    $line += 1/* Increases the line by one */
    rewind($handle); /* Goes back to the start of the file */
    fwrite($handle$line); /* Performs the increads */
    fclose($handle); /* Closes the file on the server */
    header("location: $nexturl"); /* Redirects to the $nexturl file */
    ?>
    Next make a file called redir.php and put the following in it:

    PHP Code:
    <?php $countingfile "Habbox Baby.mp3"?>
    Then you can easily make a page that displays the current stats, make a file called display.php, and put in the following contents:

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Hit Counter</title>
    <style type="text/css">
    <!--
    body,td,th {
    	color: #FFFFFF;
    }
    body {
    	background-color: #00ccff;
    }
    .style1 {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 10px;
    	font-weight: bold;
    }
    -->
    </style></head>
    
    <body>
    <?php include 'redir.php'; ?>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center" class="style1">Hits on <?php echo $countingfile ?><br />
      <br />
    <center><span class="style1"><?php
    
    // set file to read
    $file = 'counter.txt';
    // open file
    $fh = fopen($file, 'r') or die('Could not load counter.');
    // read file contents
    $data = fread($fh, filesize($file)) or die('Could not fetch counter contents.');
    // close file
    fclose($fh);
    // print file contents
    echo $data;
    
    ?></span></center>
    </p>
    </body>
    </html>
    If you put all that together into a directory, it will all work well! To view a demo of this in action click here. If you want you can make a full center out of this and you can make it display stats for all of your downloads.

    [b]To customize this all you have to do is change the following variables:

    $nexturl - Change this to the URL of your download
    $countingurl - Make this the name of the file you are counting the hits to



    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)


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

    Latest Awards:

    Default

    Pretty nice

    I was going too post a download system with a counter built in

    - Dan

  3. #3
    Join Date
    Jul 2004
    Location
    Sunshine Coast, Queensland, AU
    Posts
    1,830
    Tokens
    467

    Latest Awards:

    Default

    please do that dan

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

    Latest Awards:

    Default

    Maybe at like 5am or tomorrow night

    I'm doing a big layout on Photoshop now.

    - Dan

  5. #5
    Join Date
    Dec 2005
    Location
    Guildford, UK. Rio, Brazil.
    Posts
    95
    Tokens
    0

    Default

    @Dan: reply to PM dude.

    @topic: nice. php never works for me. I do the right stuff, but when i go and click on my index.php in my site file it doesnt work. any tips?
    there are twentyone visions in my life.
    and if you click here you'll understand why.



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

    Latest Awards:

    Default

    Quote Originally Posted by Andie
    @Dan: reply to PM dude.

    @topic: nice. php never works for me. I do the right stuff, but when i go and click on my index.php in my site file it doesnt work. any tips?
    Maybe. Does your host support PHP?

    - Dan

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

    Latest Awards:

    Default

    Eactly what I was gonna say Dan



    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)


Posting Permissions

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