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

In reply to Re^2: Finding out who has logged on remotely! by blackadder
in thread Finding out who has logged on remotely! by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.