469,635 Members | 2,432 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,635 developers. It's quick & easy.

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

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
2 4191
Ferris
101 100+
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
5,058 Expert 4TB
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.

Similar topics

9 posts views Thread by Penn Markham | last post: by
8 posts views Thread by Mike Thomas | last post: by
3 posts views Thread by Chris B. | last post: by
2 posts views Thread by Shailesh Gajare | last post: by
4 posts views Thread by Kevin Blount | last post: by
5 posts views Thread by Stinky Pete | last post: by
2 posts views Thread by RSH | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.