Jump to content


Photo

How to retrieve windows logged on user information?


  • Please log in to reply
7 replies to this topic

#1 sasha

sasha
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 02 September 2006 - 11:48 PM

Hello.
I ma fighting with one problem for about 2 weeks and cannot find any solvation.
I build a site which gonna run in a private ,domain based network, and I need a script in php which will retrieve the username of the corrent logged on to windows user.

Hope that you can help.
Thank you, sasha.

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,162 posts

Posted 03 September 2006 - 12:33 AM

see
http://www.phpfreaks....html#msg420967
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 sasha

sasha
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 September 2006 - 09:20 AM

thank you, but I need the current windows logged in information..

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,162 posts

Posted 03 September 2006 - 09:24 AM

Last time I used it, that's what it gave - the username of logged on windows user.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 03 September 2006 - 10:19 AM

Surely that would only display the user logged onto the server though wouldn't it?

#6 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,162 posts

Posted 03 September 2006 - 10:25 AM

Gives the username of the user currently running the script.
<?php
$domuser = $_SERVER['LOGON_USER'];
list ($domain, $username) = explode ('\\', $domuser);   // use '\\\\' on some servers

echo "Your username is $username";
?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#7 sasha

sasha
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 September 2006 - 10:30 AM

I get an empy value from the function: $_SERVER['LOGON_USER'];

maybe I should install any module or enable any options in httpd\php ?
I am running Apache 1.3 Win32 on winxp.

#8 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,162 posts

Posted 03 September 2006 - 10:35 AM

I've only used it with IIS and, as I stated in the other thread, anonymous access needs to be disabled or it too gives a blank value.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users