Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1
    Member
    Join Date
    Nov 2006
    Posts
    39
    Member #
    14262
    Custom made Site counter/hit counter

    I am looking to make myself a cutom hit counter using numbers that I create in photoshop. I am wondering if this is possible, nad if so, how to do it. If someone could hep me out, I'd greatly appreciate it, thanks!

  2.  

  3. #2
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    If you want to use PHP and databases or a file to store, it's really not hard. You just need to know the PHP part of it... do you have experience in that?
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  4. #3
    Member
    Join Date
    Nov 2006
    Posts
    39
    Member #
    14262
    no experience with anything but html... See, I was just hoping all it was was a simple php code that someone could copy and paste, and I just fill in the file names for the images of the numbers... If not, could someone explain to me what I have to do?

  5. #4
    Member
    Join Date
    Nov 2006
    Posts
    39
    Member #
    14262
    sooo.... does anyone know how to do this?

  6. #5
    Member
    Join Date
    Nov 2006
    Posts
    39
    Member #
    14262
    I am looking to make myself a custom hit counter using numbers that I create in photoshop. I am wondering if this is possible, and if so, how to do it. If someone could hep me out, I'd greatly appreciate it. I realize you would need to use php in order to make a hit counter, but I am not sure how to do it... I am a little more familiar with HTML than php--- That's not saying much though because I know absolutley no PHP at all... I guess I was hoping that the code would be simple: Something someone could copy and paste for me, and then I would just point to the numbers for the script to use.

  7. #6
    Senior Member tonyf12's Avatar
    Join Date
    Mar 2007
    Posts
    132
    Member #
    14998
    From a tutorial on devolopingwebs.net
    Code:
    Hit Counter
    
    1. Create a counter text file of the name hitcounter.txt and save it to the same directory you will put your hit counter in.
    
    2. Open your php editor. Save the document as counter.php. Set your opening statement for PHP script.
    
    <?php
    ?>
    
    3. Set the variable for the file named hitcounter.txt and place this between your PHP tags. remember to place the filename in quotes. place the semicolon on the end of the line to end the command.
    
    <?php
    $count_my_page = ("hitcounter.txt");
    ?>
    
    4. Set the number of visits to the current value of the contents of the hitcounter.txt file: 
    
    <?php
    $count_my_page = ("hitcounter.txt");
    $hits = file($count_my_page);
    ?>
    
    5. When the script is accessed as the page loads, it not only reads the current number of hits on the page in the hitcounter.txt, it must increase the value by 1 for the current hit to be recorded. Add 1 to your value of $hits and call it $hits.
    
    <?php
    $count_my_page = ("hitcounter.txt");
    $hits = file($count_my_page);
    $hits[0] ++;
    ?>
    
    6.Open the file that is keeping count so we can write to it
    
    <?php
    $count_my_page = ("hitcounter.txt");
    $hits = file($count_my_page);
    $hits[0] ++;
    $fp = fopen($count_my_page , "w");
    ?>
    
    7. Replace the value in the file with the new $hits number after it was incremented.
    
    <?php
    $count_my_page = ("hitcounter.txt");
    $hits = file($count_my_page);
    $hits[0] ++;
    $fp = fopen($count_my_page , "w");
    fputs($fp , "$hits[0]");
    ?>
    
    8. You must close the file next.
    
    <?php
    $count_my_page = ("hitcounter.txt");
    $hits = file($count_my_page);
    $hits[0] ++;
    $fp = fopen($count_my_page , "w");
    fputs($fp , "$hits[0]");
    fclose($fp);
    ?>
    
    9. Set the code to display your hit number.
    
    <?php
    $count_my_page = ("hitcounter.txt");
    $hits = file($count_my_page);
    $hits[0] ++;
    $fp = fopen($count_my_page , "w");
    fputs($fp , "$hits[0]");
    fclose($fp);
    echo $hits[0];
    ?>
    
    10. Save your php file in same directory as the text file.
    
    11. To use this script you just have to add a php statement that calls that php file. Use the following include:
    
    <?php
    include ("counter.php");
    ?>

  8. #7
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,715
    Member #
    5580
    Liked
    717 times
    Mike ...

    As indicated above, the basic PHP scripting to save page hits (refreshes).
    You could get fancy and use sessions to count one person as one, in case
    they click refresh over and over again.

    Once you get the main count part done, you then use PHP to take the
    count number, separate its digits and display those. This can end up being
    a mix a Javascript and PHP, or pure PHP if you wish. It would use your new
    graphic images (d0.png, d1.png, d2.png, etc ...)

    I'm assuming you're doing this as a little project to learn some PHP scripting?
    Hit counters themselves are meaningless and passe. But, as a PHP lesson, it
    might be worth messing around with.


  9. #8
    Member
    Join Date
    Nov 2006
    Posts
    39
    Member #
    14262
    Well, no I was going to use it as a hit counter on my website and, since it is an art website ( www.artforyu.com ) I was going to take some fancy looking, bloack letters and use photoshop to make them look like they were "quic sketched" by an artist and make them fairly big (I mean bold) and noticeable, somehow making them work with the site... But I might not do it at this point. It seems very complicated and I'm not really "into" learning any new scripts. Just one more thing to throw into my brain, and I am not planning on doing anything major when it comes to website design in the future.

    Anyways, thanks for your help. I'll be making note of my webstite on the "how's my site" section here to get some reviews and some help on one of my pages. If you are interested in helping me out, I'd appreciate it. Thanks!

  10. #9
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,715
    Member #
    5580
    Liked
    717 times
    Mike ...

    PM me with your email address.

    If you can email me your digits 0-9 (images),
    I can whip-up a script to display them. It's
    not too complex.

    Also with your site ...

    Most visitors won't know what you're talking about
    with security settings, so you might want to investigate
    why you need to change settings. And most people
    know that the things on the left are buttons (links), so
    you don't need to explain that either.

    If you were to look here and find a nice CSS template that
    would fit your personal needs, you could use an existing CSS
    layout that might solve some browser issues.

    http://www.google.com/search?hl=en&q...=Google+Search

    You have such nice portraits, but your website design isn't very flattering,
    (no offense intended), but a good web design with your art would make a
    world of difference.

    If your webhost allows PHP (which most do), you could also make it much
    easier to organize and display your portraits. ... but that's a different topic.


  11. #10
    Member
    Join Date
    Nov 2006
    Posts
    39
    Member #
    14262
    See, if I ever got hired to do a site again, I guarantee you I'd be back here an dI would learn to do CSS, and I'd take my time on it. But I am not getting any more payment for this, and I've got a lot of other stuff to do so, I will pass on redoing the site in CSS templates, but I'll give you those numbers via email. I'll do them up right now. Thanks SOO much.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

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

Search tags for this page

custom hit counter for websites
,

custom site counter

,
custom website counter
,
site counter in custom design
Click on a term to search for related topics.
All times are GMT -6. The time now is 04:32 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com