RE: [PHP] Hardware Detection

2005-08-23 Thread Daevid Vincent
I misread the OP. 

No. you can't get information on the hardware of a CLIENT's machine via PHP.
You may be able to do it through some JS or I'm pretty sure through some
ActiveX control (on Microsoft brosers of course). 

We make an appliance that "phones home" for updates and such, and therefore
we have the luxury of a PHP crontab script that sends this information back
to us. To us, they are "clients" -- different definition of client than the
OP though. ;-)

> -Original Message-
> From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 23, 2005 1:25 PM
> To: php-general@lists.php.net
> Cc: 'Saenal M'
> Subject: RE: [PHP] Hardware Detection
> 
> This works on Linux/Unix boxen.  
> 
> //generate the global array here so we can re-use it 
> independant of output format
> $device['os_ver'] = exec("/bin/uname -a");
> 
> $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth0 | /bin/grep
> HWaddr"), -1, PREG_SPLIT_NO_EMPTY);
> $device['MAC_addr_eth0'] = $temp[4];
> 
> $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth0 | /bin/grep
> \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY);
> $device['dot_quad_ip_eth0'] = $temp[2];
> 
> $temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth1 2>&1 
> | /bin/grep
> HWaddr"), -1, PREG_SPLIT_NO_EMPTY);
> $device['MAC_addr_eth1'] = $temp[4];
> 
> $temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth1 
> 2>&1 | /bin/grep
> \"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY);
> $device['dot_quad_ip_eth1'] = $temp[2];
> 
> # look at /var for now as that seems to be where the bulk of 
> our data is
> stored.
> $temp = preg_split("/\s+/",exec("/bin/df | /bin/grep hda1"), -1,
> PREG_SPLIT_NO_EMPTY);
> $device['hd_size'] =  $temp[1];
> $device['hd_used'] =  $temp[2];
> 
> $temp = preg_split("/\s+/",exec("/usr/bin/free | /bin/grep Mem"), -1,
> PREG_SPLIT_NO_EMPTY);
> $device['ram_total'] = $temp[1];
> $device['ram_used'] = $temp[2];
> 
> $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | 
> /bin/grep 'model
> name'"), -1, PREG_SPLIT_NO_EMPTY);
> $temp1 = preg_split("/\s\s/",ltrim($temp[1]), -1, 
> PREG_SPLIT_NO_EMPTY);
> $device['cpu_type'] = $temp1[0];
> $temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'cpu
> MHz'"), -1, PREG_SPLIT_NO_EMPTY);
> $device['cpu_mhz'] = ltrim($temp[1]);
> 
> $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep 
> 'VGA'"), 8), -1,
> PREG_SPLIT_NO_EMPTY);
> $device['video'] = $temp[1];
> 
> $temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep 
> 'Host'"), 8),
> -1, PREG_SPLIT_NO_EMPTY);
> $device['mobo'] = $temp[1];
> 
> $ethernet = `/usr/bin/lspci | grep 'Ethernet'`;
> $temp = split("\n",$ethernet);
> $temp1 = preg_split("/:/",substr($temp[0],8), -1, 
> PREG_SPLIT_NO_EMPTY);
> $device['nic_eth0'] = substr($temp1[1],1);
> $temp1 = preg_split("/:/",substr($temp[1],8), -1, 
> PREG_SPLIT_NO_EMPTY);
> $device['nic_eth1'] = substr($temp1[1],1);
> 
> $device['proc_count'] = trim(`ps auxw | wc -l`);
> 
> $device['someprocessd'] = trim(`ps axuw | grep "someprocessd" 
> | grep -v
> "grep" | wc -l`);
> 
> # Returns the uptime of a Linux system by parsing through 
> /proc/uptime. 
> # It returns a 4-field array (days, hours, minutes, seconds). 
> # I typically use it like: 
> # $ut = linuxUptime(); 
> # echo "Time since last reboot: $ut[0] days, $ut[1] hours, 
> $ut[2] minutes"; 
> $ut = strtok( exec(  "cat /proc/uptime" ),  "." ); 
> $days = sprintf(  "%d", ($ut/(3600*24)) ); 
> $hours = sprintf(  "%2d", ( ($ut % (3600*24)) / 3600) ); 
> $min = sprintf(  "%2d", ($ut % (3600*24) % 3600)/60  ); 
> $sec = sprintf(  "%2d", ($ut % (3600*24) % 3600)%60  ); 
> $device['uptime'] = $days."d ".$hours."h ".$min."m ".$sec."s";
> 
> //this version fails if the uptime is < 24 hours or 1 day 
> since it's shown
> as 20:15
> //$temp = preg_split("/:/",exec("uptime"), -1, PREG_SPLIT_NO_EMPTY);
> //$device['loadavg'] = substr($temp[2],1);
> preg_match("/load average: (.*)/",exec("uptime"), $temp);
> $device['loadavg'] = $temp[1];

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Hardware Detection

2005-08-23 Thread Daevid Vincent
This works on Linux/Unix boxen. On windows... You're on your own.


//generate the global array here so we can re-use it independant of output
format
$device['os_ver'] = exec("/bin/uname -a");

$temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth0 | /bin/grep
HWaddr"), -1, PREG_SPLIT_NO_EMPTY);
$device['MAC_addr_eth0'] = $temp[4];

$temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth0 | /bin/grep
\"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY);
$device['dot_quad_ip_eth0'] = $temp[2];

$temp = preg_split("/\s+/",exec("/sbin/ifconfig -a eth1 2>&1 | /bin/grep
HWaddr"), -1, PREG_SPLIT_NO_EMPTY);
$device['MAC_addr_eth1'] = $temp[4];

$temp = preg_split("/[\s:]+/",exec("/sbin/ifconfig -a eth1 2>&1 | /bin/grep
\"inet addr:\""), -1, PREG_SPLIT_NO_EMPTY);
$device['dot_quad_ip_eth1'] = $temp[2];

# look at /var for now as that seems to be where the bulk of our data is
stored.
$temp = preg_split("/\s+/",exec("/bin/df | /bin/grep hda1"), -1,
PREG_SPLIT_NO_EMPTY);
$device['hd_size'] =  $temp[1];
$device['hd_used'] =  $temp[2];

$temp = preg_split("/\s+/",exec("/usr/bin/free | /bin/grep Mem"), -1,
PREG_SPLIT_NO_EMPTY);
$device['ram_total'] = $temp[1];
$device['ram_used'] = $temp[2];

$temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'model
name'"), -1, PREG_SPLIT_NO_EMPTY);
$temp1 = preg_split("/\s\s/",ltrim($temp[1]), -1, PREG_SPLIT_NO_EMPTY);
$device['cpu_type'] = $temp1[0];
$temp = preg_split("/:/",exec("/bin/cat /proc/cpuinfo | /bin/grep 'cpu
MHz'"), -1, PREG_SPLIT_NO_EMPTY);
$device['cpu_mhz'] = ltrim($temp[1]);

$temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep 'VGA'"), 8), -1,
PREG_SPLIT_NO_EMPTY);
$device['video'] = $temp[1];

$temp = preg_split("/:/",substr(exec("/usr/bin/lspci | grep 'Host'"), 8),
-1, PREG_SPLIT_NO_EMPTY);
$device['mobo'] = $temp[1];

$ethernet = `/usr/bin/lspci | grep 'Ethernet'`;
$temp = split("\n",$ethernet);
$temp1 = preg_split("/:/",substr($temp[0],8), -1, PREG_SPLIT_NO_EMPTY);
$device['nic_eth0'] = substr($temp1[1],1);
$temp1 = preg_split("/:/",substr($temp[1],8), -1, PREG_SPLIT_NO_EMPTY);
$device['nic_eth1'] = substr($temp1[1],1);

$device['proc_count'] = trim(`ps auxw | wc -l`);

$device['someprocessd'] = trim(`ps axuw | grep "someprocessd" | grep -v
"grep" | wc -l`);

# Returns the uptime of a Linux system by parsing through /proc/uptime. 
# It returns a 4-field array (days, hours, minutes, seconds). 
# I typically use it like: 
# $ut = linuxUptime(); 
# echo "Time since last reboot: $ut[0] days, $ut[1] hours, $ut[2] minutes"; 
$ut = strtok( exec(  "cat /proc/uptime" ),  "." ); 
$days = sprintf(  "%d", ($ut/(3600*24)) ); 
$hours = sprintf(  "%2d", ( ($ut % (3600*24)) / 3600) ); 
$min = sprintf(  "%2d", ($ut % (3600*24) % 3600)/60  ); 
$sec = sprintf(  "%2d", ($ut % (3600*24) % 3600)%60  ); 
$device['uptime'] = $days."d ".$hours."h ".$min."m ".$sec."s";

//this version fails if the uptime is < 24 hours or 1 day since it's shown
as 20:15
//$temp = preg_split("/:/",exec("uptime"), -1, PREG_SPLIT_NO_EMPTY);
//$device['loadavg'] = substr($temp[2],1);
preg_match("/load average: (.*)/",exec("uptime"), $temp);
$device['loadavg'] = $temp[1];

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hardware Detection

2005-08-22 Thread Rory Browne
Assuming that you are running a web app then, I concour with Richard. 

If however you are talking about a client in a more traditional sense,
in that you have a specific client application, then that client
application could get the computers hard disk, in the same way as any
other application could.

In Linux, they can simply parse files like /proc/cpuinfo, or something
like that.

Why exactly do you want to do this?

On 8/22/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Fri, August 19, 2005 9:55 pm, Saenal M wrote:
> > Can we get information about hardware on client's PC. (e.g. hard disk,
> > processor, keyboard, etc).? And How?
> > anyone knows? please reply back.
> 
> Not only is it not possible, most of that information is NONE OF YOUR
> DAMN BUSINESS!!! :-)
> 
> You can assume that if the browser is sending the headers to indicate
> that I prefer French, then I probably have a keyboard that makes
> French characters.
> 
> --
> Like Music?
> http://l-i-e.com/artists.htm
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hardware Detection

2005-08-21 Thread Richard Lynch
On Fri, August 19, 2005 9:55 pm, Saenal M wrote:
> Can we get information about hardware on client's PC. (e.g. hard disk,
> processor, keyboard, etc).? And How?
> anyone knows? please reply back.

Not only is it not possible, most of that information is NONE OF YOUR
DAMN BUSINESS!!! :-)

You can assume that if the browser is sending the headers to indicate
that I prefer French, then I probably have a keyboard that makes
French characters.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hardware Detection

2005-08-20 Thread Burhan Khalid

Saenal M wrote:

Hi,

Can we get information about hardware on client's PC. (e.g. hard disk, 
processor, keyboard, etc).? And How?

anyone knows? please reply back.


No, this is not possible with PHP.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Hardware Detection

2005-08-19 Thread Saenal M

Hi,

Can we get information about hardware on client's PC. (e.g. hard disk, 
processor, keyboard, etc).? And How?

anyone knows? please reply back.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HARDWARE ID WITH PHP

2003-06-08 Thread Marek Kilimajer
You need to execute an external program (hdparm in linux) and catch its 
output.

nabil wrote:
Can anyone tell me if i can get the Hardisk serial number, by  php code?





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] HARDWARE ID WITH PHP

2003-06-07 Thread nabil
Can anyone tell me if i can get the Hardisk serial number, by  php code?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hardware Address

2002-09-06 Thread Marek Kilimajer

exec("arp $_SERVER[REMOTE_ADDR]", $output);

$output[0] should be something like
? (192.168.1.37) at 00:E0:4C:00:30:2D [ether] on eth0


Chris Cook wrote:

> Hello all,
>
> I am working on a LAN application and am interested in obtaining the 
> user's network card address to limit usage of the program. Is there a 
> way to do this in PHP?
>
> I am on a network that uses DHCP so using the IP address probably wont 
> work and I am also worried about IP spoofing.
>
> Thanks for any help you can provide,
> Chris
>
>
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Hardware Address

2002-09-05 Thread Chris Cook

Hello all,

I am working on a LAN application and am interested in obtaining the user's 
network card address to limit usage of the program. Is there a way to do 
this in PHP?

I am on a network that uses DHCP so using the IP address probably wont work 
and I am also worried about IP spoofing.

Thanks for any help you can provide,
Chris


_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Hardware ?

2002-03-04 Thread Patrick

Hi, 

this is kinda a broad question 

i have been asked to host a website that recieves a high 
access rate i dont have exact numbers but does anyone here
run a big site with php mysql and if so what are your stats
os, and hardware

i dont want to underestimate in the hardware department
but i also dont want overkill

Thanks
Patrick




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php