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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhighat4214
    New Member
    • Jul 2008
    • 13

    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
  • Ferris
    New Member
    • Oct 2007
    • 101

    #2
    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").

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

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

      PHP can execute shell commands, so doing something like:
      [code=php]
      $username = exec("whoami");
      [/code]
      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.

      Comment

      Working...