General discussions : Non mobile discussion : counter on website question - IIS question added
>
New Topic
>
Reply<
Esato Forum Index
>
General discussions >
Non mobile discussion
> counter on website question - IIS question added
Bookmark topic
EastCoastStar Posts: > 500
okay, i have added many counters to websites... (free, but not remotly hosted) I want to add my own. Normally when I do this, I have had a FTP to work with, this time, its going straight into the database on this computer/server and will load to the web right away. many things tell me to chmod (or change the premissions) im not sure how to do this without an FTP. does anyone know any good tutorials, or can help me putting a text based hit counter on a website VIA my database, not FTP? thanks!
[ This Message was edited by: EastCoastStar on 2005-11-02 17:13 ]
--
Posted: 2005-11-02 15:36:11
Edit :
Quote
EastCoastStar Posts: > 500
anyone? sorry ive been in a hurry latley lol
--
Posted: 2005-11-02 16:30:38
Edit :
Quote
You could make a counter with php and mysql if you want.
This message was posted from a Z1010
--
Posted: 2005-11-02 17:35:21
Edit :
Quote
EastCoastStar Posts: > 500
i tried that, but somewhere along the lines, i must have messed up. any other suggestions? ill go look into the mysql and php counters again and throw one together and see what happens.
thanks
--
Posted: 2005-11-02 17:36:54
Edit :
Quote
I could make you one when i get home, very simple to make. I would increment on refresh too though.
This message was posted from a Z1010
--
Posted: 2005-11-02 17:38:41
Edit :
Quote
What's wrong with remotely hosted solutions? I personally use
http://www.statcounter.com - that's an absolutely fantastic service. Proper web analyctics, rather than merely counting the number of users.
Beyond that, server log files are also good
--
Posted: 2005-11-02 17:40:09
Edit :
Quote
EastCoastStar Posts: > 500
Quote:
On 2005-11-02 17:40:09, Rocky B. wrote:
What's wrong with remotely hosted solutions? I personally use
http://www.statcounter.com - that's an absolutely fantastic service. Proper web analyctics, rather than merely counting the number of users.
Beyond that, server log files are also good
the people im making the website for want it to be all hosted under their server, nothing remotly hosted... just what they wanted haha, otherwise, i would probobly use statcounter

(or fastcounter). ive never ran into problems making my own until today haha.
@johnex, if it will increment on refresh, thats fine, that doesnt matter too much to me. but i have tried a few counters with MySQL and PHP, but for some reason they wont work. if you make me one, i would be greatful (but, i might not use it honestly, maybe something is wrong with the server over here or something). if you do make one, the i can ask you about it, and all should work fine

thank you much.
--
Posted: 2005-11-02 17:50:42
Edit :
Quote
EastCoastStar Posts: > 500
hrm... i just learned that the server is using IIS... (sumthn about SS also) so i have to confugure the IIS to run PHP... (wtf... what do i do?!)
--
Posted: 2005-11-02 18:13:05
Edit :
Quote
// PHP Counter © Johnex 2005
//=============================
//=======================//
// Database Table //
//=======================//
// Run this query in
// phpmyadmin or something...
//=========================
CREATE TABLE `wap_counter` (
`total_count` char(200) default NULL
);
//=======================//
// File: counter.php //
//=======================//
// Paste the following into
// a new file in notepad,
// save with "File Name"
// counter.php , and "Save
// As Type" as "All Files".
// Change the variables
// below to match your
// mysql settings.
//=========================
// Vars
$host = 'HOST'; // usually 'localhost'
$user = 'USERNAME'; // your MySQL Password
$pass = 'PASSWORD'; // your MySQL Username
$dbase = 'DATABASE NAME'; // whatever your database name is
// Mysql Connect
$conn = mysql_connect($host, $user, $pass)) or mysql_error();
mysql_select_db($dbase,$conn)) or mysql_error();
// Get Count
$get_count = mysql_query('SELECT * FROM counter',$conn) or mysql_error();
while ($total_count = mysql_fetch_array($get_count)) {
$count = $total_count['total_count'];
$new_count = $count + 1;
}
mysql_query("UPDATE counter SET total_count = '$new_count'",$conn) or mysql_error();
// Print
print'
<!--
function writeContent() {
'."document.getElementById('counter').innerHTML = '<b>Hits: $new_count</b>';".'
}
writeContent();
//-->
';
//=======================//
// HTML //
//=======================//
// Paste the code bellow where
// you want the counter to be
// displayed. Change the
// "src" to the folder where
// you put the counter.php
// file
===========================
<scrpt type="text/javascript" src="counter.php"></script>
<div id="counter"></div>
//=============================
Hope this helps dude
_________________
JPortal Beta
http://beta.johnex.se
------------------------
Test it out now!
------------------------
Formerly known as JohnN4
[ This Message was edited by: Johnex on 2005-11-02 19:18 ]
--
Posted: 2005-11-02 19:17:20
Edit :
Quote
EastCoastStar Posts: > 500
thanks!
a little confused... what is this part?
//=======================//
// Database Table //
//=======================//
// Run this query in
// phpmyadmin or something...
//=========================
CREATE TABLE `wap_counter` (
`total_count` char(200) default NULL
);
you said to run it in phpmyadmin, that confused me a little.
also, i added the php5 configuration to the IIS, so hopefully it will work fine
--
Posted: 2005-11-02 19:49:13
Edit :
Quote
New Topic
Reply