Page 1 of 2
how many people are connected to me in a network?
Posted: Wed Mar 16, 2005 3:32 am
by saumya
hi guys,
i am new to php,so please bear with me if it is a stupid question.
is it possible to know how many people are connected to me in my network?Ok let me explain.WE all are working in one office and we have got one server to which everybody gets connected.Well I wan to know whether it is possible to know how many people are connected to it at any given time.I mean if some body logs on to his/her pc then i should be able to see him in my html/php page.once he/she turns off the pc then it should be noticed too.
thanks
saumya
Posted: Wed Mar 16, 2005 3:58 am
by infolock
not a stupid question, but a hard one to understand...
see, i don't know if you mean if you can tell if someone is logged onto your network, or onto your page?
either way, yes, you can definately find out how many people are connected to you and what their ip's are (among other things based on what OS you are using...)
Posted: Wed Mar 16, 2005 3:59 am
by n00b Saibot
You should hmake some kinda login/logout script for them and then at any given time calculate the online ones. simple enough.
Posted: Wed Mar 16, 2005 5:08 am
by saumya
thank guys.well with a login screen its simple.but I do not want that.rather it should be autometically detect from my pc,how many people are there in my network.if they are turned on their pc then the screen should say "the particular use is on table.".can it be done?
thats like invisibly keeping an eye on them.I do not have access to myserver either.whatever I have to do is to do with my own pc.I am under a server and so as others.its actually should check how many people are currently loged in to to the main server.
thanks again for your help
saumya
Posted: Wed Mar 16, 2005 5:22 am
by Chris Corbyn
I think you can do something with sessions.... Can't quite remember what... there's a post by jason in the tutorial board on this I believe.
viewtopic.php?t=29342
Posted: Wed Mar 16, 2005 9:54 am
by feyd
So you want to find out how many people are on the LAN.. I'm assuming this is a Windows network, as I wouldn't know for a unix set up, but it should be similar..
The following should display all computers attached to the group/domain associated with the machine it is run on.
Code: Select all
<?php
var_export(shell_exec('net view'));
?>
Posted: Wed Mar 16, 2005 10:36 pm
by saumya
hi friend,my browser said NULL to your code.I think you got it right.I want to know no of people on the lan,but I am also a part of that LAN,not the server.
thank you
saumya
Posted: Wed Mar 16, 2005 11:15 pm
by feyd
you may be on the LAN but is your computer in the same domain or workgroup? That's the requirement for 'net view' to work.. There are other utilities out there that can display more detailed network information than what is availble "by default" with the OS.
Posted: Wed Mar 16, 2005 11:20 pm
by timvw
kick tcpdump/windump into action and filter out all unique mac/ip addresses..
then display those results in a page...
Posted: Wed Mar 16, 2005 11:41 pm
by saumya
ya i am in aworkgroup but still its NULL.
Posted: Thu Mar 17, 2005 1:29 am
by n00b Saibot
Yesterday, I thought of the same answer but forgot to post it afterwards.
Why does it return NULL ?
Fire up the command prompt and type 'net view' and see what that returns.
If that returns an error or does not display anything, contact LAN Admin.
Feyd's above code works real fine for me.
Posted: Thu Mar 17, 2005 1:36 am
by pleigh
i tried feyd's code above and it returned me this error
Warning: shell_exec(): Unable to execute 'net view' in c:\inetpub\wwwroot\mysample\TMP1zj0ydhjnf.php on line 3
false
Posted: Thu Mar 17, 2005 1:42 am
by infolock
care to post the code cuz it sounds like you must have mistyped it...
edit: what version of windows are you using?
Posted: Thu Mar 17, 2005 1:52 am
by pleigh
Code: Select all
<?php
var_export(shell_exec('net view'));
?>
im using windows xp
Posted: Thu Mar 17, 2005 2:00 am
by infolock
n00b Saibot wrote:Yesterday, I thought of the same answer but forgot to post it afterwards.
Fire up the command prompt and type 'net view' and see what that returns.
did you try that and see if it actually displayed anything for you? Because there is no reason why it should not work if you have windows xp (unless you don't have high enough privelages to run the command...)