Chapter 15 . (Web and email hosting) Perl Development 427 $query =
Chapter 15 . Perl Development 427 $query = SELECT host,user FROM user WHERE user = $quoteduser ; $sth = $dbh->prepare($query); $sth->execute(); while (($host,$username) = ( $sth->fetchrow_array() ) ) { if ($host eq ) { print User $user has a blank host entry.n ; } else { print User $user is allowed to connect from: $hostn ; } } } sub priv { # This subroutine looks up the grants for the given # user/host pair. ($user,$host) = @_; $query = SHOW GRANTS FOR $user@$host ; $sth = $dbh->prepare($query); $sth->execute(); while ($grant = ( $sth->fetchrow() ) ) { print $grantn ; } } Figure 15-42: Usage examples of the MySQL User Management program I ve built with the DBI
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.