corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP Help (getenv("USERNAME") )


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author PHP Help (getenv("USERNAME") )
Ash_EP3
Member

Registered: 15th May 07
Location: Melksham, Wiltshire
User status: Offline
25th Jun 08 at 08:54   View User's Profile U2U Member Reply With Quote

Hi people,

Me and the IT Officer need help in terms of getting the windows client username, to display on the .php page!?

We are using:
- Apache 2.2
- MySQL5
- PHP5

We have tried coding used by others on the net (I have tried PHP freaks) and still no luck

HEEEEEEEEEEEEEEEEEEEEEEELP!
Dom
Member

Registered: 13th Sep 03
User status: Offline
25th Jun 08 at 10:56   View User's Profile U2U Member Reply With Quote

Try _SERVER["REMOTE_USER"] - but i think it requires the client to authenticate with the apache server. Although when it does work, it returns a windows 2k style login ie: Domain\Username rather than username@domain etc.

However, i would use javascript to grab the username and then parse it to php using php parameters - ie: index.php?usr=bob etc then just to a phpget/post on the url and grab the username. Could run a basic encrypt on the username string if you worried about people seeing it.

Below is javascript that grabs the windows username. Just use a javascript refresh and construct the url with the username variable!

code:

var wshshell = new ActiveXObject("wscript.shell");
var username = wshshell.ExpandEnvironmentStrings("%username%");

Ash_EP3
Member

Registered: 15th May 07
Location: Melksham, Wiltshire
User status: Offline
25th Jun 08 at 14:09   View User's Profile U2U Member Reply With Quote

Thanks Dom, however I am not sure this would work, we are not allowed to use ActiveX

Dom
Member

Registered: 13th Sep 03
User status: Offline
25th Jun 08 at 15:06   View User's Profile U2U Member Reply With Quote

If that doesnt work then you're limited to using the remote_user, but ideally you'll have to run client side script to get the username.

Is it not possible for the client to enter their login details? Would mean checking it again AD records but once you do that you can store the username as a cookie/session etc for further use!
Tim
Site Administrator

Avatar

Registered: 21st Apr 00
User status: Offline
25th Jun 08 at 22:40   View Garage View User's Profile U2U Member Reply With Quote

Use mod_auth_sspi for Windows transparent authentication. The Windows username would then be available as getenv(LOGON_USER)...
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
25th Jun 08 at 22:43   View Garage View User's Profile U2U Member Reply With Quote

And reply to your other thread about databases which we masterfully fixed for you
xa0s
Banned

Registered: 4th Mar 08
Location: Dartford, Kent Car: Turbo'd Fabia vRS
User status: Offline
26th Jun 08 at 01:36   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by Tim
Use mod_auth_sspi for Windows transparent authentication. The Windows username would then be available as getenv(LOGON_USER)...

You know your shit!
Ash_EP3
Member

Registered: 15th May 07
Location: Melksham, Wiltshire
User status: Offline
26th Jun 08 at 08:25   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by Ian
And reply to your other thread about databases which we masterfully fixed for you


thanks Ian, Tim, Luke & Dom - Me and the IT Officer have both been looking around at other "geeky" forums and on Google etc but haven't had a lot of luck

Are we right in thinking that we just copy the module (mod_auth_sspi) over into the modules folder on Apache? and then tell the config file to load up the module correctly??? (just a tad unsure )



[Edited on 26-06-2008 by S214_UPP]

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Username change! Rob General Chat 63 936
27th Feb 03 at 09:50
by Ditch
 
How do I change my Username p1723944 General Chat 66 1069
11th Nov 04 at 08:55
by henry_corsa
 
Maybe Ian or Tim will know this, but anyone else too... PaulW Geek Day 7 966
16th Dec 03 at 19:50
by Trucido
 
php help *Donna* Geek Day 15 413
26th Feb 05 at 10:02
by AK
 
Anyone know PHP? Bit of help needed... liamC Geek Day 38 1430
24th Nov 06 at 23:02
by MarkPW
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP Help (getenv("USERNAME") ) 29 database queries in 0.0081999 seconds