in reply to Re: Finding out who has logged on remotely!
in thread Finding out who has logged on remotely!

These are the changes that I did, and it seems to work (I do get and display and no errors)!
#! c:/perl/bin/perl.exe -slw use strict; use vars qw/%data/; use Win32; use Win32::NetAdmin qw(LoggedOnUsers); use Win32::AdminMisc; use CGI qw (:standard); my $data{host} = param('hostname') || Win32::NodeName(); my $data{user} = Win32::AdminMisc::GetLogonName(); my $data{IP} = Win32::AdminMisc::GetHostAddress($data{host}); print "\n\nHello $data{user},...\n"; print "Remote Hostname is => $data{host}\n"; print "Remote TCP/IP Address is => $data{IP}\n"; my %user_ref; LoggedOnUsers($data, \ %user_ref); if (!%user_ref) { print "\nOooops : "; print Win32::NetAdmin::GetError()."\n"; } else { while (my ($a, $b) = each %user_ref) { print "$a, $b\n"; } }
The Output
Hello SYSTEM,... Remote Hostname is => DNA001910 Remote TCP/IP Address is => 10.60.1.54 6, amy.miles;UK;GENRUNUDC02 3, Administrator;UK;GENRUNUDC02 7, Administrator;UK;GENRUNUDC02 9, Administrator;UK;GENRUNUDC02 2, Administrator;UK;GENRUNUDC02 8, claire.calway;UK;GENRUNUDC02 1, Administrator;UK;GENRUNUDC02 4, Administrator;UK;GENRUNUDC02 0, DNA001910$;CASH; 5, Administrator;UK;GENRUNUDC02
But I still have few questions?

1- is no 9 is the last person to login?

2-when I change the parameter in the URI the display doesn't change! i.e if I enter a URL http://localhost/cgi-bin/test.cgi?hostname=dna1111119 then I would get a display of some sort but if I change the hostname to something else, the display doesn't change!!!

3-do I need the line print "Content-Type: Text/Plain\n\n" in every CGI code! it seems if I omit this line my MS-IE browser throughs error 500!

Please enlighten me,.....Thanks indeed

Blackadder