Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Computer Name of Client 1

Status
Not open for further replies.

stoolpigeon

Programmer
Aug 1, 2001
309
US
A question very similar to this was asked a couple years ago but never got an answer. (So I did dig around before asking.)

Is there a way for PHP to get the computer name of a client machine?

I am running PHP w/Apache on a linux box. The workstations are all windows.(Everything is 'in house' this does not connect to the internet anywhere) I'm building a time and attendance system. Along w/knowing who has logged in I would like to know the name of the computer where they logged in.

If this is possible I've had no luck finding out how it can be done.

thanks for any help,
Ron
 
That might be because HTTP does not provide that functionality directly.

One workaround: Set all the workstations in your office to static IP addresses. Record the IP address and name of each machine, then provide that data to PHP to look up. In a small network, it's probably the easiest thing.

Another workaround: If your network is too large to use the previous idea, or must use DHCP, standardize to Internet Explorer. Write a Microsoft-Java or ActiveX control which populates a hidden field on the form with the machine name when the user logs in.

______________________________________________________________________
My God! It's full of stars!
______________________________________________________________________
 
Thanks - I thought that might be the case - but it can never hurt to ask.

Option one is definitely not doable but I can take a look at 2.

I appreciate the quick response.

thanks again,
Ron
 
As you use linux, is your nameserver on linux or unix too?If so you have the possibility of using exec() with nslookup for the host ip address, this should return what you need, otherwise if you have samba running shares you *should* be able to use exec('smbclient -L &quot;\\\\<ip address>\\&quot;') to gain the samba share name. - I'm currently on the same mission, so I'll post what works when I get time to finish it :) ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Because in house DNS will normally return an IP address as the hostname, not the internal hostname which is required.

I did think about and try this myself, to no avail, which is why I'm now looking for an alternative to finding hostnames from I.P Address.

The favourite is exec() with nslookup but it does depend on how your internal system is configured and if the nameserver is configured correctly etc etc.

If you have any useful ideas I'm happy to hear them too. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Anikin! KarveR! Play nicely!

Theologian, if you are not running Win9x or Windows ME or XP Home edition on your workstations, there is another option.

If you are using Active Directory based networking, then Microsoft's DNS can populate the forward and reverse DNS zones for you from data in Active Directory. Giving advice on how to set it up is beyond my abilities.

And I believe the same can be done between WINS and Microsoft DNS on NT-based networks.

Then you can put your MS DNS as the only nameserver in /etc/resolv on your web server, which will force it to look there for DNS. Then you can either use Anikin's or KarveR's idea about host-by-address lookups. [Note: I suggest you let them thumb-wrestle to decide which of them is right.]

Remember, though, that the IP networking on all machines must be set up correctly, including the domain name in which the machine resides, for this to work. That domain name does not have to be real to the outside world, or even registered. I've used company.foo as the domain name before. But it has to be set up consistently for this to work.

______________________________________________________________________
My God! It's full of stars!
______________________________________________________________________
 
Thanks for all the info.

To be frank a lot of it leaves me behind rather rapidly.

I will save this thread's info for information and hopefully down the road I will be able to read it w/a greater degree of comprehension.

I really do appreciate the ideas though.

thanks again,
Ron
 
Good idea sleipnir214,

Theologian, if you are using Win2K Server and its built in DHCP (not sure if you can manage it with separate DHCP) you can tell it to update its DNS every time it gives out an address to any Win 9x/NT/2000/XP client.

This will allow you to do reverse lookups on the IP of any of your Windows clients.

[smurf]
01101000011000010110010001110011
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top