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

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Calimero
Forum Contributor
Posts: 310
Joined: Thu Jan 22, 2004 6:54 pm
Location: Milky Way

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

Post 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]
Last edited by Calimero on Sun Jan 25, 2004 8:45 am, edited 1 time in total.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post 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.
Post Reply