コード例 #1
0
ファイル: 3.0.1.php プロジェクト: GuillaumeFromage/AlternC
}
// If we upgrade directly to 3.1 the panel directory change
$panel = '';
if (chdir("/usr/share/alternc/panel")) {
    $panel = '/usr/share/alternc/panel';
} elseif (chdir("/var/alternc/bureau")) {
    $panel = '/var/alternc/bureau';
}
if (empty($panel)) {
    echo "Problem to load panel library";
    exit(1);
}
require "{$panel}/class/config_nochk.php";
$db2 = new DB_System();
// we go super-admin
$admin->enabled = 1;
$db->query("select distinct uid,login,pass from db;");
//on insere dans dbusers avec enabled = admin
$query = array();
while ($db->next_record()) {
    $db2->query("select id from dbusers where name ='" . $db->f('login') . "' and password='******'pass') . "';");
    if ($db2->num_rows() == 0) {
        $query[] = "insert ignore into dbusers values(''," . $db->f('uid') . ",'" . $db->f('login') . "','" . $db->f('pass') . "',\"ADMIN\");";
    }
}
foreach ($query as $q) {
    $db->query($q);
}
?>
//done ? :)
コード例 #2
0
ファイル: m_admin.php プロジェクト: GuillaumeFromage/AlternC
 /** 
  * Returns an array with the known information about resellers (uid, login, number of accounts)
  * Does not include account 2000 in the list.
  * May only be called by the admin account (2000)
  * If there are no reseller accounts, returns an empty array.
  * 
  * @global    type $err
  * @global    type $mem
  * @global    type $cuid
  * @return    boolean
  */
 function get_creator_list()
 {
     global $err, $mem, $cuid;
     $creators = array();
     $err->log("admin", "get_reseller_list");
     if (!$this->enabled || $cuid != 2000) {
         $err->raise("admin", _("-- Only administrators can access this page! --"));
         return false;
     }
     $db = new DB_System();
     $db->query("SELECT DISTINCT creator FROM membres WHERE creator <> 0 ORDER BY creator ASC;");
     if ($db->num_rows()) {
         while ($db->next_record()) {
             $creators[] = $this->get_creator($db->f("creator"));
         }
     }
     $creators2 = array();
     foreach ($creators as $cc) {
         $creators2[$cc['uid']] = $cc;
     }
     return $creators2;
 }