Hi there,

As my first post here i woul just like to introduce myself, I am WebAsh haha, im from NZ so thats why im so cool 😃

Anyway, lets cut to the chase...

Here at my house i have a little LAN with a windows domain server which hosts an Apache webserver running PHP as a module and MySQL and various other services. Now, I want to setup an intranet site on my server, that automatically logs in whoever visits it by using their current windows login. However, I have no idea how to obtain that information, thats why i came here. Any ideas?!?

PS: If you need more info about my situation just ask! 😃

    i really doubt you can do that.

    a lot of people use thier real name as windows logins. if it was possible, that would be a serious privacy issue.

    but if you can modify the computers in your network, maybe you could work something out. i know a lot of spyware messes e/ IE's user agent string, so modifying what headers ie sends is prob feasible. or maybe you could do it with activex....

      Yeah i dont think its possible either but i was being hopeful....

      thanks for the suggestion, ill see what i can find out.

        Double check phpinfo(); You might find a user name at the very bottom (in the server variables section). If not, you're kinda stuck unless you get crafty with ActiveX and IE.

          thanks for the suggestion, but i have no idea where to start with ActiveX.... ah.... i think i may just have to have a login script :S

            How are the IPs being assigned Statically or Dynamic?

            You could probably from there check what there IP Address is an have a table of some kind to check IP to get the name. Although there is a chance for multiple login usernames.

              im not sure how ie handles cookies for different users, but if it keeps them seperate, you could just set a cookie w/ a long lifetime, so they only need to login once, or you could manually place the cookie in thier computers

              again, im not sure if ie seperates the cookies, but if it did that would make it easy.

                Originally posted by planetsim
                How are the IPs being assigned Statically or Dynamic?

                You could probably from there check what there IP Address is an have a table of some kind to check IP to get the name. Although there is a chance for multiple login usernames.

                Dynamic, but yeah, people can log on to different computers, which is why rehfeld's idea is as perfect as it is going to get... that was my backup plan if i couldnt get what i wanted in the first place... im pretty sure IE saves them as username_here@website_here... i could be mistaken but hopefully not. but ill give it a try...

                Thanks for all your help guys 😃

                  WebAsh Have you ever considered using your computers Windows User accounts for logging in users. That way you could restrict them a lot better however you would still have to find a way to get the username and password against your computer. Why do you need there username and password from windows.

                  This all sounds a bit .:WaReZ:. to me

                    I just wanted to drop a note and let you know that your original request is possible, but not with Apache. You'd need to switch over to IIS. Now, I'm not recommending that you do that, I'm just saying it is possible.

                      Originally posted by rehfeld

                      again, im not sure if ie seperates the cookies, but if it did that would make it easy.

                      Yes, XP/W2K have per user settings, stored in C:\Documents and Settings\User

                        Originally posted by cyberlew15
                        WebAsh Have you ever considered using your computers Windows User accounts for logging in users. That way you could restrict them a lot better however you would still have to find a way to get the username and password against your computer. Why do you need there username and password from windows.

                        This all sounds a bit .:WaReZ:. to me

                        Ok, i think your a bit lost... i dont need the password, and im not wanting this as a form of logging into the computer, i just need it so that the user that IS logged into the computer is automatically logged into the intrantet page using their windows username... but anyway we have discoverd it is not possible so dont worry about it....

                        Originally posted by remnant
                        I just wanted to drop a note and let you know that your original request is possible, but not with Apache. You'd need to switch over to IIS. Now, I'm not recommending that you do that, I'm just saying it is possible.

                        Damit... i dont want to move to IIS... its shit! lol... argh.... well im just going to have to make people log in then....

                        thanks for all your help, ill just use Basic auth and cookies...

                          3 months later

                          I tried it and newr to that.

                          youcan get from the windows registry

                          I use the php_win32std.dll for exploring the registry

                          check on windows
                          start --> run --> type regedit
                          open HKEY_CURRENT_USER

                          open Volatile Environment

                          you will see the APPDATA contain the path of the user name

                          you can get from that.

                          here is the code I try

                          <?php
                          $strMainKey= 'Volatile Environment';
                          $mainKey= reg_open_key( HKEY_CURRENT_USER, $strMainKey );
                          if( !$mainKey ) err( "Can't open '$strMainKey' !" );
                          echo "'$strMainKey' Key opened\n\nKeys:\n<br>";
                          print_r( reg_enum_key($mainKey) );
                          for( $i= 0; $key= reg_enum_key($mainKey, $i); $i++ ) {
                          echo "\t$key\n <br>";
                          }
                          echo "\nValues:<br>\n";
                          print_r( reg_enum_value($mainKey) );
                          for( $i= 0; $value= reg_enum_value($mainKey, $i); $i++ ) {
                          echo "\t$value=".reg_get_value($mainKey, $value)."<br>\n";
                          }
                          reg_close_key($mainKey);
                          ?>

                          Hope thats help

                          if someone can modify that code and get the clear user in variable let me know I have to use it too

                            Write a Reply...