Click to See Complete Forum and Search --> : [RESOLVED] Getting computer's system's login?
lubatico
07-26-2006, 02:39 PM
Greetings, everyone.
Is there any way to write a script that would obtain (automatically, without the need for a login form) the username and password for the local user's machine?
I know this sounds strange, but I am writing an application for our local intranet in which the users have to identify some documents I'll post on the pages and then fill up a form with send it to me. Of course, I need to know who sent what, so I am interested in "capturing" that user's name and attaching it to the form, automatically.
Has anyone done that?
My many, many thanks in advance.
Cheers,
L
etully
07-26-2006, 04:09 PM
Fortunately for people who like their privacy, such a feature does not exist. You'll have to live with the idea of asking them their name and letting them decide whether or not they want to provide it.
You do, however, know their IP address and since it's an Intranet, you know who is at each IP address. Just include this line in the form:
<input type=hidden name=ip_address value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
ColdFusion
07-26-2006, 05:16 PM
The short answer to this is no, and thats the same for the long one too probablly :)
But as stated above you could have the ip address information stored... just remember to ensure that your network pc's that are involved are using static ip addresses.... otherwise there is no point as the IP addresses may keep changing each time the machine is switched on.
thorpe
07-26-2006, 05:43 PM
You'll need to research the possibilty through COM. php can provide an interface to COM, however your question would be best asked on an MS board.
eg; How do I retrieve a users login name through COM?
lubatico
07-28-2006, 03:26 PM
Thanks for the answers!
I cannot use the IP addresses, though, as we have dynamic IP's on our intranet.
Of course, I could write a little script to check with the dns server and retrieve that information, but would rather - at least at this point - avoid such cumbersome solution.
I will investigate the one about COM.
Thanks for your suggestions. If I find anything, I'll post it here. Meanwhile, if anyone has any other suggestions...:)
Cheers,
L
bradgrafelman
07-28-2006, 10:11 PM
What webserver and network are you running? I believe this would be feasible if you're running IIS on an Active Directory-based network.
barand
07-29-2006, 12:50 AM
This works on a windows intranet using IIS so long as anonymous access is disabled
$dom_user = $_SERVER['LOGON_USER'];
list ($domain, $username) = explode ('\\', $dom_user);
(You may need to explode with '\\\\' depending on version)
MarkR
07-29-2006, 04:18 AM
If you want to do NTLM automatic authentication in IE, the settings have to be exactly right- IE has a lot of security features to stop it authenticating with just any old one automatically - normally it means the site needs to be in either the "intranet zone" or "trusted zone".
Oh yes- and the feature may be turned off entirely by default in some installations, by policy. Also people logged on with local accounts can't use it, nor can users of (most) non-MSIE browsers.
Additionally of course you need access to the user's windows domain controller in order to be able to do this (either directly or via some Active Directory network).
Mark
lubatico
08-03-2006, 11:51 AM
The solution!!
Thank you all for your kind and valuable answers.
I was a bit afraid of using COM or other "foreign" technologies to integrate it with my php.
The $_SERVER['LOGON_USER'] works fine, except that I needed anonymous user access for the rest of the intranet.
So, I decided to go for the lazy, easy way. I simply created a virtual directory within my intranet and removed the anonymous user from that directory. Now, I can user the $_server... variable with impunity and pass, if need be, to the other script. Or I can write my script on this area.
Many thanks to all of you.
All the best!
Lubatico
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.