Файл: EasyHost v2.0/system/htdocs/manager/mysql/default.pl
Строк: 40
<?php
$system->error ( 'You must enter a name for the database' ) if ( length $system->param ( 'name' ) == 0 );
$system->error ( 'Invalid database name' ) if ( $system->param ( 'name' ) !~ /^[w_]+$/i );
$system->error ( 'You have reached the maximum allowed MySQL databases assigned to your account' ) if ( $login->user->config ( 'mysql_databases' ) > 0 and $system->mysql->selectrow_array ( 'SELECT COUNT(*) FROM db WHERE User = ? AND Host = ?', undef, $login->user->name, $hostname ) >= $login->user->config ( 'mysql_databases' ) );
my $userExists = $system->mysql->selectrow_array ( 'SELECT COUNT(*) FROM user WHERE User = ? AND Host = ?', undef, $login->user->name, $hostname );
$system->mysql->do ( 'CREATE DATABASE '.$login->user->name.'_'.$system->param ( 'name' ) );
$system->mysql->do ( $userExists ?
'GRANT ALL PRIVILEGES ON '.$login->user->name.'_'.$system->param ( 'name' ).'.* TO '.$login->user->name."@$hostname" :
'GRANT ALL PRIVILEGES ON '.$login->user->name.'_'.$system->param ( 'name' ).'.* TO '.$login->user->name."@$hostname IDENTIFIED BY ?", undef, $login->user->password
);
$system->redirect;
?>