Functions like getlogin and getpwuid return the info for the user running the script. When you run the script at the command line, the user is you. When the web server runs the script as the request of an HTTP request, the user is the one your web server is configured to run as -- in this case, www-data.
What current login name are you trying to get? There are many methods you can use to require visitors to your web site to login, from basic HTTP authentication using .htaccess/htpasswd (which will put the username in $ENV{REMOTE_USER}), to form- and/or cookie-based session/login systems that are common in many frameworks. Each of these will provide the username in a different way, so it will depend on what login system you use.
In reply to Re: Get the currently logged in User name
by aaron_baugher
in thread Get the currently logged in User name
by irah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |