PHP help - writing user name to MySQL database

Soldato
Joined
9 May 2005
Posts
7,400
Location
Berkshire
Hoping some one can help with this. I'm a bit of a noob when it comes to php and mysql but I'm usually able to work my way through things.

At the moment I have a php application called Ackertodo. It's an open source to do list that I want people in my office to start using. Basicaly the idea behind it is that they have daily tasks that they must complete and record having done.

What I want to happen is that when the user hits complete on a given routine that it will not only complete the routine, but also write the logged in XP user name into the notes field on the MySQL database.

Can anyone help with this? I know in principle it's simple but I'm not really sure where to start.

Thanks
 
Hi mate,

You want to add the field into the notes field in the database correct? So you simply need to concatenate the username onto whatever data is being inserted into the database. You need to hack the PHP code to do that.

Getting the logged in username will be more difficult. PHP can't do it as its a server-side language, you might be able to do this if the webserver is in the domain.

$_SERVER['LOGON_USER']

or

$_SERVER['AUTH_USER'].

Check phpinfo(). Might also be able to grab it using JavaScript.
 
Back
Top Bottom