Author |
counter on website question - IIS question added |
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
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 ] |
|
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
anyone? sorry ive been in a hurry latley lol
Its good to be back! |
Johnex Joined: Nov 26, 2002 Posts: > 500 From: Stockholm/Sweden PM, WWW
|
You could make a counter with php and mysql if you want.
This message was posted from a Z1010 |
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
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
Its good to be back! |
Johnex Joined: Nov 26, 2002 Posts: > 500 From: Stockholm/Sweden PM, WWW
|
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 |
Rocky B. Joined: Jan 15, 2005 Posts: 357 From: Leicester, England PM, WWW
|
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
|
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
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. |
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
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?!) |
Johnex Joined: Nov 26, 2002 Posts: > 500 From: Stockholm/Sweden PM, WWW
|
// 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 ] |
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
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 |
Johnex Joined: Nov 26, 2002 Posts: > 500 From: Stockholm/Sweden PM, WWW
|
Run that "query" in a mysql interface, i use phpmyadmin. I suggest you install it, http://www.phpmyadmin.net/home_page/
EDIT: Re-copy the script, i made a small change in the counter.php file.
_________________
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:19 ] |
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
the guys im workin with dont want me to get in with the SQL server, becuase they run alot on their SQL, and they are worried something might get messed up :- im looking for a non SSI and non mySQL solution :-\ hrm...
this would be so much easier if i was at home and could do it the way i wanted to hahaha
[ This Message was edited by: eastcoaststar on 2005-11-02 19:31 ] |
Johnex Joined: Nov 26, 2002 Posts: > 500 From: Stockholm/Sweden PM, WWW
|
k, one sec then......
|
EastCoastStar Joined: Dec 07, 2003 Posts: > 500 From: orlando fl US PM |
thanks, i owe you!
Its good to be back! |
Johnex Joined: Nov 26, 2002 Posts: > 500 From: Stockholm/Sweden PM, WWW
|
// PHP Counter © Johnex 2005
//=============================
//=======================//
// 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.
//=========================
// Make File, Read Count, Add 1, Write New Count
if(file_exists('count_file.txt')) {
$count_file = fopen('count_file.txt', r);
$count = fread($count_file, filesize('count_file.txt'));
$new_count = $count+1;
fclose($count_file);
$count_file = fopen('count_file.txt', w);
fwrite($count_file,$new_count);
fclose($count_file);
} else {
$count_file = fopen('count_file.txt', w);
fwrite($count_file, 1);
$new_count = '1';
fclose($count_file);
}
// 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
===========================
<div id="counter"></div>
<scrpt type="text/javascript" src="counter.php"></script>
//=============================
Flat File Version
_________________
JPortal Beta
http://beta.johnex.se
------------------------
Test it out now!
------------------------
Formerly known as JohnN4
[ This Message was edited by: Johnex on 2005-11-03 15:02 ] |
|