RE: Is there any way of knowing User Currently Logged On?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If it throws out garbage, you should be able to execute the "who" command on
the remote system, which should show users that are currently signed on to a
Unix or Linux system and if you do it all in the perl script, you can format
the output to look pretty much the same (in case you haven't figured it out
the @users_list is an array, very similar to PHP arrays actually [IMHO]).
If you modified the perl script to detect the garbage, it could simply do a
telnet connection and execute the "who" command.  There are probably ways
that use privileged commands similar to the one used for your windows
solution on remote Linux Unix, but I don't know them, and I'm not sure it's
a good idea to use them in a PHP script, but you can get opinions the other
way as well.  If all your machines are behind the same firewall, away from
the internet, the risk could be less if you have a good firewall.  For your
telnet connection from perl look for the net:telnet perl module at
http://www.cpan.org/modules/by-module/Net/ , if you know PHP you will find
perl quite easy I think.

Good luck.

Warren Vail

-----Original Message-----
From: Mulley, Nikhil [mailto:mnikhil@xxxxxxxxxxxxx]
Sent: Monday, October 11, 2004 9:54 PM
To: Vail, Warren; Mulley, Nikhil; php-general@xxxxxxxxxxxxx
Subject: RE:  Is there any way of knowing User Currently Logged On?

Hi Vail,

My Worry is that If a remote OS is not Windows, then this would throw out
garbage,
Where as this Perl Script would work well at a Windows Side ,Bcoz I am using
the 'Win32'  Module ,is there any other module such that .....
We cannot even predict ( or I believe there is no exact way ) what the
remote OS could be :(



Nikhil.

-----Original Message-----
From: Vail, Warren [mailto:Warren.Vail@xxxxxxxxxx]
Sent: Monday, October 11, 2004 11:33 PM
To: 'Mulley, Nikhil'; php-general@xxxxxxxxxxxxx
Subject: RE:  Is there any way of knowing User Currently Logged On?


If you code in php something like the following, you just might be able to
use the perl script;

$ok = exec("path/to/Perl myperscriptname.pl server", $result);   // you may
have to straighten out syntax
Foreach($result as $line) {
    echo $line;   // or you could process the results
}

Hope this helps,

Warren Vail


-----Original Message-----
From: Mulley, Nikhil [mailto:mnikhil@xxxxxxxxxxxxx]
Sent: Monday, October 11, 2004 9:52 AM
To: php-general@xxxxxxxxxxxxx
Subject:  Is there any way of knowing User Currently Logged On?


Hi Guys,

Is there any way of finding the current user logged on the remote system

I have a perl script which gets the user name who is currently logged on a
remote Windows Machine





#LoggedOnUsers(server, userRef).pl
use Win32::NetAdmin;
use strict;
use vars qw($server @users_list);
if(@ARGV>0){
$server=$ARGV[0];
}
else{
print "\n\nEnter a valid Hostname  or IP Address : ";
chomp($server=<STDIN>); }
Win32::NetAdmin::LoggedOnUsers($server,\@users_list);
foreach(@users_list) {
print "\n$server    --     $_";
}


This one gets the users logged in on a remote Windows machine , Is there a
similar way of finding / doing the same regardless of an OS, Can it be done
through a Web Browser ????

Any Clues ??

--Nikhil.

--
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux