DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 27, 2018, 01:42:12 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: Index Page Hit Counter  (Read 6154 times)
0 Members and 1 Guest are viewing this topic.
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« on: February 06, 2005, 01:02:20 AM »

Just go into settings, alter the amount of hits to which you feel that your site has gotten already, or gestimate, or just start from scratch. Updates upon refresh of index/home page.

Sometimes, I just get bored and write things for no reason at all.

http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=75
« Last Edit: July 07, 2006, 02:15:41 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #1 on: February 06, 2005, 03:55:47 AM »

Thanks for this as well, looks good:D
Very useful
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #2 on: February 06, 2005, 12:42:01 PM »

Thanks for this as well, looks good:D
Very useful

You're welcome. I was just in the mood to make hit counters, since I created my own for my website out of PHP, so I was like "I'll make one for LotGD"
« Last Edit: February 06, 2005, 12:42:45 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #3 on: February 06, 2005, 01:12:43 PM »

I just love the LotGD getsetting/setsetting/set_module_pref/get_module_pref/get_module_setting/ set_module_setting functions. Makes everything a whole lot easier.
I also like the output buffer idea, because when you use the echo function and you've sent stuff and you want to terminate output, it's tough unless you send some javascript, plus some browsers can/will ignore it...
anyway, I'm going offtopic.
« Last Edit: February 06, 2005, 01:13:18 PM by CortalUX » Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #4 on: February 06, 2005, 01:34:13 PM »

Awww, I liked it the old fashioned way:
Code:
$count = "SELECT value FROM ".db_prefix("module_prefs")." WHERE modulename='hitcount' AND setting='count'";
$count++;
$sql = "UPDATE ".db_prefix("module_settings")." SET count=$count WHERE modulename='hitcount'";
db_query($sql);

[/sarcasm]

Hehe...
« Last Edit: February 06, 2005, 01:35:04 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #5 on: February 06, 2005, 01:50:49 PM »

*ducks and hides from the SQL code  Wink *
EEK!
*walks out of the topic*
CortalUX has left the building.

Edit: Yay! 100th post
2nd Edit: And very informative it is too Wink
« Last Edit: February 06, 2005, 01:52:05 PM by CortalUX » Logged
Jim
Guest
« Reply #6 on: February 06, 2005, 02:50:33 PM »

I do not see in the code how to get this to display under "Choose a different display skin:" Maybe I'm missing something?
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #7 on: February 06, 2005, 02:53:51 PM »

I do not see in the code how to get this to display under "Choose a different display skin:" Maybe I'm missing something?

It doesn't display there, it displays around the Statue area, above the login. I already tried all the available hooks for index: footer, header and index. None display where I wished for it to display, so it is to stay at the place it is now, until a new hook is put in.

There is no hook for underneath the Display Skin Selector for now.
« Last Edit: February 06, 2005, 02:54:48 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #8 on: February 06, 2005, 03:10:38 PM »

Weirdly enough, I saw this on your site earlier Sicahe, as my brother asked what I was doing. I showed him a few LotGD's and saw that counter on yours, I contemplated making one as it hadn't been released, couldn't be bothered, and lo, my prayers are answered Wink
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #9 on: February 06, 2005, 03:21:59 PM »

Weirdly enough, I saw this on your site earlier Sichae

Well, for anyone that wishes to put one in on their website (Non-LotGD) I have written a tutorial on how to make one in PHP:
« Last Edit: April 18, 2005, 10:52:03 AM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #10 on: February 07, 2005, 04:20:18 AM »

great tutorial, you might want  to tell users that if an error occurs, it'll (hitcounter.txt) have to be set 'chmod 777', if not on a windows server.
There's a better one '60 something' that doesn't set it world writable, but I can't remember what it is.
Logged
lonnyl
Guest
« Reply #11 on: February 07, 2005, 05:52:18 AM »

I haven't looked at this.... but why would you use a text file when you have DB access???  

set_module_setting('hitcount',get_module_setting('hitcount') +1);

I dislike writable text files on the server......

and thinking of that.... why don't we have a function in the game (or 2)

increment_module_setting('hitcount",1);

and a increment pref function, maybe even decrement functions.....
could reduce sql calls in the game quite a lot....
Logged
lonnyl
Guest
« Reply #12 on: February 07, 2005, 06:11:48 AM »

Awww, I liked it the old fashioned way:
Code:
$count = "SELECT value FROM ".db_prefix("module_prefs")." WHERE modulename='hitcount' AND setting='count'";
$count++;
$sql = "UPDATE ".db_prefix("module_settings")." SET count=$count WHERE modulename='hitcount'";
db_query($sql);

[/sarcasm]

Hehe...

Actually the old way would be

Code:
$sql = "UPDATE ".db_prefix("module_settings")." SET count=count +1 WHERE modulename='hitcount'";
db_query($sql);

actually rather efficient.... and this set of code is what made me think of  the increment setting/pref function and see it's usefullness.....  

with the current method of setting and getting we have two calls.... with the increment functions we would only be using 1 sql call....   I know that there are a ton of places in the core and in my modules that would benefit from these functions.  
Logged
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #13 on: February 07, 2005, 06:13:24 AM »

Grin

that would be really great... but increment_module_pref() and increment_module_setting() would be enough... They'd just have to allow negative values... Smiley

could reduce this
Code:
$x = get_module_pref("prefname");
$x++;
set_module_pref("prefname", $x);

to just:
Code:
increment_module_pref("prefname", 1);

great idea!!!
Logged

Running for more than three years now:
CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #14 on: February 07, 2005, 06:18:29 AM »

that wasn't for LotGD. That was for a normal web server.
And that 'old way' was supposed to be a joke.. for one thing it didn't fetch an array or query the server.. I could nitpick a lot of things like that.. sense of humour
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
29 Guests, 1 User
pharis
Home Forums News Downloads Login Register Advanced Search