#!/usr/bin/php $data) { $membre=$data[0]; $srvid=$data[1]; $ok=@mysql_fetch_array(mysql_query("SELECT * FROM dbusers WHERE uid=$uid AND NAME='".$uid."_myadm';",$res)); if (!$ok) { echo "Creating user ".$uid."_myadm for login ".$membre."\n"; $pass=create_pass(8); mysql_query("INSERT INTO dbusers SET uid=$uid, name='".$uid."_myadm', password='$pass', enable='ADMIN';",$res); echo mysql_error(); } else { $pass=$ok["password"]; } echo "Granting rights to user ".$uid."_myadm for login ".$membre." ... "; // Now granting him access to all user's databases mysql_query("GRANT USAGE ON *.* TO '".$uid."_myadm'@'".$client[$srvid]."' IDENTIFIED BY '$pass';",$srv[$srvid]); echo mysql_error(); $t=mysql_query("SELECT * FROM db WHERE uid=$uid;",$res); echo mysql_error(); while ($d=mysql_fetch_array($t)) { mysql_query("GRANT ALL ON ".$d["db"].".* TO '".$uid."_myadm'@'".$client[$srvid]."';",$srv[$srvid]); echo " ".$d["db"]; echo mysql_error(); } echo "\n"; }