sunilvadranapu Posted July 22, 2008 Share Posted July 22, 2008 Hi, How do I read client side environment variables using PHP ? What I want to do is: In our intranet, every one login into their system with windows userid. whenever user in the our intranet opens my web page, it should be able to get their userid(windows userid) and accordingly show their tasks to do. bases on the userid the tasks list will vary. I will be glad if anyone can share their experience or point me to correct direction. thanks, sunil Quote Link to comment Share on other sites More sharing options...
s0c0 Posted July 22, 2008 Share Posted July 22, 2008 Well this is very hard if not impossible since PHP as you know is a server side language and therefor has great difficultly accessing client side information. Off the top of my head though here are two options. If you have a windows 200x domain server you might be able to get this information through some LDAP calls. I did some stuff with LDAP back in my network admin days: http://blog.cnizz.com/?s=ldap Your other option is to install apache and php on the local machine, store the username is a text file, access the text file via php, and create an iframe in your webapp that accesses the local machine, passes the information to your app (such as ip and username) to your app and try something like that. Honestly if you can get something working it will be a hack. Something like this is better suited for java or c# etc... Rather than writing this yourself, have you thought about looking for some open source software that does this already. Or better yet if you run exchange and outlook use that, or whatever your mail solution is see if there is integration there. Good luck. Quote Link to comment Share on other sites More sharing options...
unkwntech Posted July 22, 2008 Share Posted July 22, 2008 Another option would be to use JavaScript/AJAX to feed the info to another script that adds it to a session or a database. Quote Link to comment Share on other sites More sharing options...
s0c0 Posted July 22, 2008 Share Posted July 22, 2008 Another option would be to use JavaScript/AJAX to feed the info to another script that adds it to a session or a database. This would then have to be initiated by the client then right? That could be difficult. Another idea is running a login script once the client logs in to update the database. You could write something this in VBScript, Python, or maybe even if you're luck in a batch file. Not sure that it would work with a session, unless you maybe had the login script create a cookie. You would have to create the cookie in multiple browsers or limit support to a single browser. Quote Link to comment Share on other sites More sharing options...
natbob Posted July 22, 2008 Share Posted July 22, 2008 The way I would do it would to use a batch file like the following to open a browser and pass the URL paramater, this would have no security though as you could just edit the GET variable. start C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "http://www.me.com/myscript.php?user=%USERNAME%" Then the php script would get the user name and do somthing with it. PS: Remember if I was a malicious user I could just go to http://www.me.com/myscript.php?user=admin and log in as admin. You could also verify by computer name with %USERDOMAIN%. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.