| 
	
 | 
 Posted by Tim on 06/02/06 17:54 
Bob Sanderson wrote: 
> I have created a MySQL database for my company which is accessed by PHP 
> pages. I would like to permit some users to edit the records but allow 
> others read-only access. However, I don't want to have to enter a password 
> every time I want to edit a record. Is there a way to use our network login 
> to do this? If not, what is the easiest way to accomplish this? The 
> database is running on our server and is not accessible via the net. 
> 
> Any help will be greatly appreciated. 
 
This is one way to do it 
 
In mysql use CREATE USER and GRANT to set up a user account with read 
only permissions, you probably have a user account with full 
permissions to use but you may want to setup another user account with 
limited write permissions to give to others. 
 
In the php script call a system command to get the login name of the 
current user. On *nix systems its 'whoami', on windows I think its 
whoami.exe but don't quote me on that.. 
 
Check the result of whoami and change the user and password arguments 
in mysql_connect accordingly. 
 
Regards 
 
Tim
 
  
Navigation:
[Reply to this message] 
 |