Jump to content

restrict call to mysql_query() function


Vikas Jayna

Recommended Posts

I am trying to make a middle layer for interaction between the database and the applications

 

Hence I created a function _db_query() that is to be called to execute any query throughout the application on our site. This function does some decision making about which server the query should go to. The function uses mysql_query() function then to execute the query on that server. The issue is that I need to restrict the use of mysql_query() function from anywhere else in the application and force them to use the function _db_query() so as to avoid mistakes in case a programmer forgets to call _db_query() and instead calls mysql_query()

 

Any ideas about implementing this?

Link to comment
Share on other sites

I'm actually not sure it can be done. You cannot overide a function in php and while you can disable functions, that disables the function install wide.

 

One thing you could do would be to hide the user/pass, making it impossible to connect to a database unless calling the _db_query function which would then also need to handle the connection.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.