Getting info about local machine

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hibbeac1
Forum Newbie
Posts: 13
Joined: Thu Oct 30, 2003 10:25 am

Getting info about local machine

Post by hibbeac1 »

Anyone know of any ways i can get info on the local machine such as memory used, CPU type etc. So i can display information like this on a web browser.

Already know how to get disk space, IP address and Operating System, just can't get the rest
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

In my opinion that is not possible because programms that show you the CPU, memory usage, for example are restricted to the root account.

I'm even wondering where you got the disc space from. 8O :?:
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

This can be done with JavaScript or VBscript..... not PHP because PHP is server-side. JS and VBS are client-side.
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

Gen-ik wrote:This can be done with JavaScript or VBscript..... not PHP because PHP is server-side. JS and VBS are client-side.
Sorry I didn't note it was about the client but still I'm wondering about the disk space......
hibbeac1
Forum Newbie
Posts: 13
Joined: Thu Oct 30, 2003 10:25 am

Post by hibbeac1 »

You can get information on the hard disk (well only its storage) like this:-
$diskspacefree = round((disk_free_space("/") / 1073741824), 2);
$diskspacetotal = round((disk_total_space("/") / 1073741824), 2);

As for the using Javascript to get some more information i'll have to look into it. Unless anyone has any ideas.

Thanks for your replies.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Just out of curiosity why do you need all of this information about the users machine?

If it's for use on a website and the visitors find out your 'scanning' their machine like that then you're going to find your hit count dropping like a rock..... I for one wouldn't return to your site.


Anyway, other methods of guestimating the CPU speed and Connection speed are.....

CPU:
Create a Flash movie and time how long it takes to run through X amount of frames. While this doesn't give a precise CPU speed it will give you a rough idea of the users pocessing power. You'll need to use JS to record the time and get Flash to run an FScommand when it reaches frame X..... then do time/frames.

Connection Speed:
Again this is using Flash but instead of timing how long it takes to run through X amount of frames you will be checking how long it takes to load a Flash file. While this isn't an instant result due to the fact that the Flash file needs to load it will give you a good result. KBOfSWF / secondsTakenToLoad = X kb per second
Post Reply