This is a discussion on "A PHP web counter?" within the PHP Forum section. This forum, and the thread "A PHP web counter? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
A PHP web counter?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
A PHP web counter?
I know my host allows PHP and I have my page built in html. can someone please tell me a code where I can add the php tags into my HTML and have a web counter? that would be mega nice of you!
-mark |
|
|
|
|||
|
In order to put PHP into your HTML files, you need to rename all your .html files to .php extensions.
You can then put "<?php php_code ?>" anywhere in that PHP file. There is only one difference between a .html file and a .php file. And that is that you can use PHP in the .php file. Otherwise, they work exactly the same in every way. If you're looking for a PHP web counter to put on your site, it would require some sort of database. However, I'd probably advise finding a site that you can use a web counter off of. If you have cpanel they should have a built in feature that allows you to create your own web counter |
|
|||
|
Hi Mark,
You need somewhere to store the count, either a database or a text file. Seeing as it's pretty stupid to use a database for just one piece of information, a text file is much better! First create an empty file called hitcounter.txt. Then make another file called hitcounter.php and put in the following code:
You can use: include ("hitcounter.php"); to include the file in any other, so that when they hit that page it is counted too. To make the counter silent (so it doesn't display a number) remove the line "echo $hits[0];" |
|
|||
|
Ah sirkent, I've forgotten about flat-file storage!
Just to add, make sure the "hitcounter.txt" has read and write privleges... So you'd need to chmod it to "0755" (is that correct?). You should be able to "chmod" a file via your FTP client. |
|
|||
|
Yes, CHMOD is important, sorry. 755 should do the trick.
|
|
|||
|
Wow... !! you guys have helped me soooo much! Thank You! if you would like to see my new sleek top of the line php web page the location is at http://www.hostultra.com/~k3nshin/
- Mark |
|
|||
|
oh lol forgot to tell you... DONT LAUGH!! hehe im still learning all this php and other stuff! so Thanx again and ill cya around!
|
|
|||
|
It looks fine to me! The only thing worth mentioning is that the green bar on the right stops before the bottom. Looks good, keep it up!
|
|
|||
|
nice site, whats "Rurouni Kenshin" then
|
|
|||
|
I LOVE THIS FORUM! hehe but anyways Rurouni Kenshin is an Anime started by Nobuhiro Watsuki ummm that wont help heres a link to a better Rurouni Kenshin fansite. http://www.geocities.com/kkfan007
|
|
|||
|
I'm sorry to rain on your parade k3nshin, but that's a freeweb template. Did you know that it is illegal to take someone's template, and try to pass it off as your own?
You may have modified it, but you're still using the same basic layout, colors, and images as that template. |
|
|||
|
((oh god not more templates))
|
|
|||
|
Yea I know right... but that template is built into freewebs. I see people using it all the time.
|
|
|||
|
I'm sorry I didnt spend the time writing all that pointless HTML I alreaddy know... besides tell me please where on my site it says its mine? I never said it was mine but merely used it.
Liking the forum level: 7/10 |
|
|||
|
Lol, you like us less because we mention the truth?
|
|
|||
|
No sirkent I dont like the forum less rather the person that said that... sorry if there was any confusion
|
|
|||
|
<blockquote id="quote"><font size="1" face="geneva, verdana, arial" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by k3nshin
I'm sorry I didnt spend the time writing all that pointless HTML I alreaddy know... besides tell me please where on my site it says its mine? I never said it was mine but merely used it. Liking the forum level: 7/10 <hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"> Really? Well when you removed that little blurb at the bottom of the template that said "made and built by freewebs", it thus leaves anyone that see's your site to insinuate that you built that template, what else would we think? Pointless HTML you already know? Hmmmm... I guess the language used in every single web site is pointless. Liking the forum level: 15/10 |
|
|||
|
Also it has your copyright info at the bottom.. I doubt you own any copyrights, don't put a symbol unless you can back it up.. Copyrights aren't free things you get cause you use a symbol. People pay dearly for them.
|
|
|||
|
Put a small disclaimer at the bottom of your page, something like: Site layout or adapted from an idea <site link>.
People won't think any less of you, if anything it will do you credit. People go to your site because of content, not design. Whats with the rating, 7/10? I think you did a typo, shouldn't it have been 10/10. u2o |
![]() |
| Tags |
| php, web, counter |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Age Counter | acrikey | JavaScript Forum | 4 | Jun 2nd, 2008 12:37 |
| Counter | confused | Website Planning | 6 | May 21st, 2007 03:27 |
| Email Counter | usfgeoff | PHP Forum | 3 | Jan 21st, 2007 23:09 |
| hit counter? | skyfire400 | Web Page Design | 6 | Mar 7th, 2006 14:00 |
| print "$counter times 2 is ".($counter*2)."<br>" | gwx03 | PHP Forum | 6 | Dec 10th, 2003 10:50 |