Using popen() to Read the Output of the UNIX who Command : System Command : Development PHP Source Code


PHP Source Code » Development » System Command »

 

Using popen() to Read the Output of the UNIX who Command






<html>
<head>
<title>Using popen() to read the output of the UNIX who command</title>
</head>
<body>
<h2>Administrators currently logged on to the server</h1>
<?php
$ph = popen"who""r" or die"Couldn't open connection to 'who' command" );
$host="www.navioo.com";
while ! feof$ph )  ){
    $line = fgets$ph, 1024 );
    if strlen$line <= )
        continue;
    $line = ereg_replace("^([a-zA-Z0-9_-]+).*""<a href="mailto:\1@$host">\1</a><BR>n",$line );
    print "$line";
}
pclose$ph );
?>
</table>
</body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Development
» System Command