[Home]

New Site View Counter!!!

By: Shy - [07/28/2022]

Hello Visitor # 8805!!



I decided to learn me a lil php, and by that I mean I copy and pasted some stuff from stack overflow and modified it a lil bit to work correctly.

Originally I just wanted to use php to automatically update the year at the bottom of the homepage, which was pretty easy once I figured out the format of the php date function. I am wanting to use php because the site already uses php for the BBS, which can be found in the other stuff section if you are not cool enough to look for it yourself/don't know the direct link...

The BBS has a view counter already so I thought, hmmm maybe I can add a view counter to the bottom of my home page as well. I decided nah I don't like those things and plus im sure it would be more complicated, but I still wanted to have my view count go up when someone visted the home page. I went and read through the bbs code for the view counter and figured out how I can add to it. The bbs uses multiple files to allow for high traffic view counting, but since my home page is pretty low traffic I just bypassed that and write to a single file. This means if 2 people load the homepage at the same exact time it will only count one of them, but that isn't really that big of a deal.

There have been over 500 visits to the BBS since I added it back in March of 2022. While you can just refresh the page and make counter go up up up, a lot of those views are actually from real random visitors. Instead of having a 2nd view counter to track home page views I am just adding to the bbs views. So now the view count goes up anytime someone visits: the BBS, the home page, OR this post (just so you can see it in action).

The cool thing about this setup is it is VERY easy to create new view counters for any page on the website I want. I could start putting up PER article counters and have them displayed in the article list. Though I think that is a lil obnoxious. Maybe for certain articles like the discord one I will throw on a unique counter at the bottom of the page since I am courious as to how many people actually have read it, probably NONE since I wrote it a while ago.

That is pretty much it. I have a ton of projects going on right now but I hope to finish writing up the hogsmeade article someitme in the near future. Writing these lil updates take pretty much no time at all, this whole ordeal of figuring out how to use php only took about an hour. Webside creation is fun and cool if you don't have your own website wtf r u doin my man??? I am willing to sub lease my server if u got $$$