Execute help command and check its output : System Command « Development « PHP






Execute help command and check its output



<?php
$command = "help";
$logged_in = explode(' ', shell_exec($command));
for ($i = 0; $i < count($logged_in); $i++) {
   if ($argv[1] == trim($logged_in[$i])) {
      $found_user = 1;
   }
}
if($found_user) {
   print "User $argv[1] is currently logged in\n";
} else {
   print "User $argv[1] is NOT currently logged in\n";
}
?>
           
       








Related examples in the same category

1.Porter scanner
2.Ping server
3.Execute shell command 'dir'
4.Ping command
5.Using exec() to Produce a Directory Listing
6.Calling the man Command
7.Using popen() to Read the Output of the UNIX who Command
8.Using popen() to Pass Data to the column Application