There are many mysql databases on the server. Some of them should be available only on certain days.

Is there a PHP command that can enable and disable access to certain databases so that access to these specific databases in the disabled state is only through " PHP My Admin "? Functions similar to these do not fit:

<?php if (date_format(date_create(), 'Ym-d') == '2015-07-17' or date_format(date_create(), 'Ym-d') == '2015-08-01') { die('Увы, нет доступа'); } else { mysql_connect(...); } // То есть например 17 июля или 1 августа, например 
  • And where will the data on when to climb to a base, and when not to go? - Vesper
  • I do not know: D. I thought I would help someone come up with something) - nick
  • In any case, the solution is not in a couple of lines. For example, to create a table in a certain database, where access is always (up to the one that is not published in phpmyadmin), with the structure "database name (string), allowed (bool), start (datetime), end (datetime)", and query with the current date in this table by the base name and interval. If there are records, take the value "allowed" from the result (and if there are not one lines in the result and conflicts, think up how to resolve), otherwise say "it is possible". Further options. - Vesper
  • Functions similar to these do not fit - please specify what criteria they do not fit. - aleksandr barakin
  • What is it for? Where are you going to use it and for what purpose? - ReinRaus

1 answer 1

  1. create an additional user. the main one will always have access to phpmyadmin, and the second one will register in their scripts that they communicate with the server.

  2. create scripts with GRANT ... REVOKE to the database, which will deprive the second user of privileges. commands to give, of course, under the main user. hide these scripts somewhere above the www folder.

  3. run these scripts by cron