Possible Duplicate:
How to read Windows loged in username with PHP/IIS
I'm work on php tool that generate Data Access layer and generate some folders and files to user but i need to know how can i get username for current windows user to generate these folders on desktop
ex:
C:\\users\\<username>\\desktop
I need to know the username.
If by current windows user you mean the user running the script then that is set in an environment variable which you can get using:
If you want to get the home directory of the user running the script you should use
This should output either C:\Users\Fred or C:\Documents and Settings\Fred depending on if you are using windows Vista/7 or windows XP.
To see all of the environment variables you can do: