Page 1 of 1

[SOLVED]GRANT to PHP script but to no one else IS IT POSSIBL

Posted: Sun Jan 25, 2004 3:03 am
by Calimero
Hello and greetings to all of those daring souls who entered this realm willingly> :wink:

I have MySQL db, I will write php scripts that will query db, but how do I grant permission to PHP scripts to query (SELECT, INSERT, DELETE) db, but no one else can be allowed to do so. PHP script is on localhost (the same machine or server)

I know about GRANT command in MySQL,
GRANT <privileges> ON <database> TO <user> [IDENTIFIED BY <password>

[b]HOW to edit <user> and INDENTIFIED BY commands to adapt them to php query (is thios done in the PHP or mysql [/b]

Posted: Sun Jan 25, 2004 3:30 am
by patrikG
The security comes in on the database side. The database requires a username and password when you connect to it: [php_man]mysql_connect[/php_man].

You can write or download a php script for user-management. Have a look at http://www.hotscripts.com or http://www.phpclasses.org.

The reason for me advising you to use PHP and not MySQL to use user-management is simple: keep the application logic in one place. Everything else complicates things unnecessarily.