print "Sorry, choice number $todo isn't known inside the program .. See ya\n";
quit();
}
my @hosts = split(/,/,$host);
$user = $dbh->quote($user);
$db = $dbh->quote($db);
if ($pass eq '')
{
$pass = "''";
}
else
{
$pass = "PASSWORD(". $dbh->quote($pass) . ")";
}
foreach my $key (@hosts)
{
my $key1 = $dbh->quote($key);
my $sth = $dbh->prepare("select Host,User from user where Host = $key1 and User = $user") || die $dbh->errstr;
$sth->execute || die $dbh->errstr;
my @r = $sth->fetchrow_array;
if ($r[0])
{
print "WARNING WARNING SKIPPING CREATE FOR USER $user AND HOST $key\n";
print "Reason: entry already exists in the user table.\n";
}
else
{
$sth = $dbh->prepare("insert into user (Host,User,Password) values($key1,$user,$pass)") || die $dbh->errstr;
$sth->execute || die $dbh->errstr;
$sth->finish;
}
$sth = $dbh->prepare("INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) VALUES ($key1,$db,$user,$priv)") || die $dbh->errstr;