Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Site Statistics (for those of you who know HTML/java)

Author
Message
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 25th May 2004 05:25
Board URL: http://forums.mindset1.com

Hey all,

I've had this idea for a while, but I'm not sure if it's possible, so I'm just going to be straight forward with it and find out whether or not it's possible.

I'm the administrator of http://www.mindset1.com, a religious debate website. What I'd like to do is have a statistics table on the home page that displays both site and forum statistics, sort of like the Info Center on my forums.

I've thought about it and there are only two ways that I've come up with that might work. The first would be to use frames, which frankly I'm not excited about doing. The second would require access to my CGI bin on proboards, which I'm pretty sure I don't have. So, is there any other possible way that this can be done?

Any ideas at all would be greatly appreciated (even using frames). Thanks in advance.

By the way, what I'd like to do specifically in that table is say "Who's Online: " and then list everyone who is online based on what the forums say. Sorry if that's a bit confusing...


Team EOD :: Programmer/Storyboard Assistant
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 25th May 2004 10:40
Hey Steve,

You could easily use PHP if you've got it...
I'm not too sure about Java's File capabilities, but you may be able to use that also.

What you'd do is set up a folder that had a couple of files in it, and when someone logs on, you add their IP/name to the list... When they leave ( close the page/sign out ) that file is updated and their IP/name is taken out.

( How this could be done in HTML or Java, I'm not sure, but I know it's reletively painless in PHP ).

And to display who's online etc, you could just read in that file.

Hope that gives you a start.
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Everwhat Studios
20
Years of Service
User Offline
Joined: 28th Apr 2004
Location: UK
Posted: 25th May 2004 11:56
I don't know if its the kind of thing you want, but Bravenet.com do a free site counter with some pretty comprehensive stats, the code is served from their servers if your host can't run scripts

The forum user formerly known as Kangaroo2.
If the apocalypse comes, email me
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 25th May 2004 13:19 Edited at: 25th May 2004 13:20
to get the ip address in php is really straight forward.


and to find what browser they are using I made a script like this.




theres a million snippets on the web on how to write to a simple text file.(dont forget to chmod666)
heres one i found on a site



you can also use the gd library to display is a graphical table.

btw i love php coming from icky perl


fall down seven times, stand up eight
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 25th May 2004 23:23
Eh, I guess I wasn't clear enough.

Okay, go to http://forums.mindset1.com. Scroll the whooole way to the bottom. Do you see the "Info Center" table? I want to be able to use those statistics.

I think that's pretty clear. Is there any way I can do that? I don't want to use PHP for this because the statistics that I display on the home page are the statistics for the forums. I hope that makes sense.

And I also hope that's at all possible.


Team EOD :: Programmer/Storyboard Assistant
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 25th May 2004 23:27 Edited at: 25th May 2004 23:28
Your board looks to be hosted by Proboards. IT's very unlikely you can use their database from PHP.

If you want a "xyz users online" thing, then you can use the one I have on my web site!

Simply put this image on your page:

http://www.davidtattersall.me.uk/php/usersonline.php?mode=img&name=[countername]

Replace "[countername]" with a name unqiue to that counter. YOu might want to use "HZence".

Example HTML:

<img src="http://www.davidtattersall.me.uk/php/usersonline.php?mode=img&name=hzence">

Additionally, if you want some text before and after the stats:



Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 26th May 2004 00:02
Quote: "Your board looks to be hosted by Proboards. IT's very unlikely you can use their database from PHP."


...right...which is pretty much what I said...

Well Dave, it looks good, except if there's only one user viewing the site it still says "are". Also, is there anyway you can change the text style? If so, that'd be great. Thanks.


Team EOD :: Programmer/Storyboard Assistant
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 26th May 2004 00:09
Well, no

The best option is to just place the image inside some text, it may look dodgy but I'll add that feature soon

I'm experimenting abit with different fonts in GD... I'll see if there are any more.

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 26th May 2004 01:02 Edited at: 26th May 2004 01:04
Quote: "I'm experimenting abit with different fonts in GD... I'll see if there are any more."


Well, even if you could make it the basic Arial, Helvetica, sans-serif style, at about 12 pt (size 2), that'd be great.

EDIT: The other idea I had (which I tried to explain) was to "link" to the forums page, harvest the information from Info Center, and display it on the home page. IE if on the forums it said "66 Members" I could somehow gather that and re-display it via Java or HTML.

Not sure how or if that would work though....but if someone could help that'd be great.


Team EOD :: Programmer/Storyboard Assistant
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th May 2004 15:28
That would require a client side script of some sort... Cos the page that it's accessing is already in the user's Internet Cache. And I'm pretty sure you can't use a client side script to write to a file on a website... But, i may be wrong...

Also, you'd need to somehow read the text in the HTML file ( again client side ), and break it apart, then find the text you want... and that would be almost impossible I think ( I don't beleive you can read files from a web page ( the client side forum page ), due to security issues ).

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 26th May 2004 20:25
Quote: "EDIT: The other idea I had (which I tried to explain) was to "link" to the forums page, harvest the information from Info Center, and display it on the home page. IE if on the forums it said "66 Members" I could somehow gather that and re-display it via Java or HTML."


I think that's more of a server side script.

The way I would do it, if I had my own web space, would just be to use PHP to read from the database and extract the member info from there.

Without that, you're stuck. There is no way with a remotely hosted forum you can access that info and harvest it onto another page.

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th May 2004 11:54
What you might be able to do is use PHP and the aquire command to read in the entire page from the other server, before it's loaded, ie, make a script that executes before the page is loaded, and that would give you the entire page, and all you gotta do then is stick it into an array, explode the part that conatins the text you want, and then display that on the home page...

Again, not too sure if that's possible though.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 27th May 2004 12:08
There is a PHP script that allows you to read in a whole page and extract the code between certain tags. If you can get your forum main page to display the stats between certain tags, ie.

<stats>
There are xyz members....
</stats>

Then it may be possible to to extract the HTML within those tags and display it on the page.

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th May 2004 14:03
David, I think his problem is that he wants on his home page a thing that says "there are this many people on the forums"... And that information is part of the forum main page which is stored externally on the other server...

Thus, he cannot access the script which says how many people are online... All he can do is get the page, then decopmile it. So changing the page so that there are special tags around the "there are ..." part wouldn't be possible.

I think what I suggested would do you, but I'm not 100% sure.

In more detail, what you'd do:

When the HOME PAGE ( not the Forums main page ) is loaded, you'd have a script ( server-side PHP ) that uses the aquire command ( or something like it ) to open the Forum Main page and read each line of the HTML into an array ( pretty simple to do )

Once you've done this, you'd then do a search of the array for the text "There Are..." and then just use a bit of tricky string manipulation to get the part that actually says how many people are online... For example, you could use the Explode command with a space " " as the exploder... and then search the newly created array for the word before the number, then the next array value is the amount of people online. But there are many way's to skin a cat.

Now that you have the actual number, you can store that in a variable, and use that variable on the HOME PAGE that you would continue to load at this point... And, voila !

Hope This Helps Steve
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 27th May 2004 21:46 Edited at: 27th May 2004 21:48
Quote: "David, I think his problem is that he wants on his home page a thing that says "there are this many people on the forums"... And that information is part of the forum main page which is stored externally on the other server..."


My answer does cover that

There are two ways to get that info.

1) read out of database - can't do that if its remotely hosted
2) read off (extrct from) forum page - in theory can be done in PHP. You can either include the page from PHP for load it as a file (I think)


Quote: "So changing the page so that there are special tags around the "there are ..." part wouldn't be possible."


I did say *if you can* - I didn't think it was possible, was just explaining a thoery that would technically work

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 28th May 2004 05:50
lol, alrighty, sorry for picking apart your post...

Jess.

PS Steve, did this all help?


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 28th May 2004 07:31
Well, yes and no.

I like the idea and it makes sense. Problem is I don't know any PHP (nor Java, only a little bit of HTML. Though I do know C++ which is kind of like Java, and kind of like PHP I hear), so I would have absolutely no idea how to go about. I'm a very amateur web developer, more of the game dev type actually but I'd still love to be able to do this.

Thanks for pointing me in the right direction. Now let's just see if I can figure out how to do it...


Team EOD :: Programmer/Storyboard Assistant
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 28th May 2004 07:57
Great

Go to the PHP Website and look at the documentation... It is really good. And that's how I learnt PHP...

You should pick it up in no time...

Have a good one

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 28th May 2004 12:09
This might help...

http://forums.devshed.com/showthread.php?t=145952

Two strings walk into a bar. I'll have a pint says the first$%ASLDJ09920D"$"$D. Excuse my friend says the second, he isn't null terminated.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th May 2004 13:28
I think you mean javascript, because java wouldn't be used for this.

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-11-25 10:17:09
Your offset time is: 2024-11-25 10:17:09