By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

PHP Function To access the Current User who's logged in

P: 13
Hello all,
I wanted to know if there is a PHP function which could display the name of the user that is currently logged in? Also could PHP code access and execute WIN32 API functions ? Kindly guide me regarding the same.

Regards,
Abhijit
Aug 24 '08 #1
Share this Question
Share on Google+
2 Replies


Ferris
100+
P: 101
I think you can't do this with Apache alone.

you can run IIS on port 8080 , and run Apache on port 80, and create a ASP or ASPX page to get current User and echo it. Then, you can visit ASP or ASPX page in PHP ,something like fopen("http://localhost:8080/getuser.aspx").
Aug 25 '08 #2

Atli
Expert 5K+
P: 5,058
Hi.

What do you mean by "the Current User who's logged in"?

PHP can execute shell commands, so doing something like:
Expand|Select|Wrap|Line Numbers
  1. $username = exec("whoami");
  2.  
Should give you the name of the user running the PHP service (or the HTTP server service, if PHP is being run as a module).

As to the Win32 API, check out the W32api extension.
Aug 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.