View Single Post
  #6  
Old 15th January 2013, 23:58
czdavid czdavid is offline
Member
 
Join Date: Aug 2008
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Till can you check if is it right, please?
Im not sure, if it is right place in source.

I use $usage_limit variable for define mysql limits.
$usage_limit variable is put two lines down bellow is defined.

Code:
           // Create the database user if database is active
			if($data['new']['active'] == 'y') {
				
				if($data['new']['remote_access'] == 'y') {
          $this->process_host_list('GRANT', $data['new']['database_name'], $data['new']['database_user'], $data['new']['database_password'], $data['new']['remote_ips'], $link);
				}
				$usage_limit = 'WITH MAX_QUERIES_PER_HOUR 100000 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 10';
				$db_host = 'localhost';
				mysql_query("GRANT ALL ON `".str_replace(array('_','%'),array('\\_','\\%'),mysql_real_escape_string($data['new']['database_name'],$link))."`.* TO '".mysql_real_escape_string($data['new']['database_user'],$link)."'@'$db_host' IDENTIFIED BY PASSWORD '".mysql_real_escape_string($data['new']['database_password'],$link)."' ".$usage_limit.";",$link);

				
			}
Reply With Quote