 |
NextCode Open Source Software Creation
|
| View previous topic :: View next topic |
| Author |
Message |
jer2665
Joined: 13 Jul 2004
Posts: 5
Location: Connecticut
|
| Posted: Tue Jul 13, 2004 4:01 am Post subject: database graphical counter |
|
|
Fantastic script, I'm really glad I found this, I was just looking for a decent counter because I'm feeling incredibly lazy right now, and came across your program which is a whole lot more than a counter.
I like this, a nice easy way to check this stuff out instead of going through logs and all. Plus having the counter thrown in there is nice too. But I have a question, I haven't been able to find anything on the site about this, but how do I get the graphical counter? Is there a built in function for that, or do I have to do my own explode and use the gfx/cnt_whatever file? Let me know, and thanks for a great program. |
|
| Back to top |
|
Vlad Alexa Mancini
Joined: 07 Jul 2003
Posts: 303
|
| Posted: Tue Jul 13, 2004 7:07 am Post subject: |
|
|
my bad , a graphic counter function is only available for logfile logging
i wlll add one for database logging in the next version |
|
| Back to top |
|
jer2665
Joined: 13 Jul 2004
Posts: 5
Location: Connecticut
|
| Posted: Tue Jul 13, 2004 2:39 pm Post subject: |
|
|
Cool, thanks for the quick help. I'll just add it on the page myself. Keep up the good work.
I hope I'm not stepping on any toes, but I just added the function to my site, and figured i'd throw it here if anyone felt like using it. If there's a better way to do it, let me know, I just threw this together quick and it works. Hope you don't mind me stealing your count.gif and your way of showing it. If you do, let me know.
For anyone interested in using a database, and wants a visual counter, enter this code somewhere in inc.func.php, obviously not in the middle of another function, but before or after any function, doesn't matter to me...
Code: function db_count_show($tname){
$i = 0;
$query = "SELECT ip FROM `$tname`";
$result = mysql_query($query) or die ("Failed to read $tname<br>Debug info: $query");
$countn = mysql_num_rows($result);
$cntn = strlen($countn);
echo "
<table border=\"0\">\n
<tr>\n
<td width=\"122\" height=\"36\" background=\"phpsitestats/gfx/count.gif\">\n
<div align=\"center\" valign=\"center\">\n";
while($i < $cntn) {
$tmpnum = substr($countn, $i, 1);
echo("<img src=\"phpsitestats/gfx/cnt_{$tmpnum}.gif\">");
$i++;
}
echo "</div>\n</td>\n</tr>\n</table>\n";
unset ($i);
}
first thing though, is you're going to have to download count.gif, i've attatched it (again, mancini or whoever made this script, feel free to delete it if you don't want people using it). you should probably make sure that the links are correct, like the links to the images and stuff, i didn't care to go through the script to see if there was a variable to point to where you have phpsitestats installed, so i just did it this way. Obviously, this is set up because i have my counter on my main page, and then in a folder called phpsitestats is the script. Hope that makes sense. Other than that, just use the code <?PHP db_count_show("table"); ?> just like all the other scripts. Obviously in "table" you put the name of your table.
Hope that makes sense, any problems let me know i'll try to clear them up. And coders, if you know a better way, let me know, this is just a down and dirty version to do it quickly.
p.s. no im not taking credit for this, 86% of the code I just copied from the function for a flatfile, I just changed it around quickly. |
|
| Back to top |
|
Vlad Alexa Mancini
Joined: 07 Jul 2003
Posts: 303
|
| Posted: Tue Jul 13, 2004 3:11 pm Post subject: |
|
|
well behaviour like this can get you in big trouble if you keep it up , namely a spot on the PHPSiteStats developers team ;)
haven't tested the code yet and don't mind if i issue a warning to be carefull while using it to whoever reads this thread
the new PHPSiteStats version is not due before the end of this month so we'll talk more then |
|
| Back to top |
|
jer2665
Joined: 13 Jul 2004
Posts: 5
Location: Connecticut
|
| Posted: Tue Jul 13, 2004 3:18 pm Post subject: |
|
|
mancini wrote: well behaviour like this can get you in big trouble if you keep it up , namely a spot on the PHPSiteStats developers team ;)
haha, i started reading that going "wtf? is he serious" about the whole it can get you in big trouble, then i read the last part
mancini wrote: haven't tested the code yet and don't mind if i issue a warning to be carefull while using it to whoever reads this thread
the new PHPSiteStats version is not due before the end of this month so we'll talk more then
yeah no problem at all, good idea "use my function at your own risk, nothing really happens that can be bad, but I don't wanna hear about it if you screw it up" how's that? :D |
|
| Back to top |
|
Vlad Alexa Mancini
Joined: 07 Jul 2003
Posts: 303
|
| Posted: Tue Aug 03, 2004 2:58 pm Post subject: |
|
|
| allright , i added the code/feature with only minor changes to version 0.6 TBA |
|
| Back to top |
|
| |
|