Example #1
0
$act = $_POST['act'];
$go = $_POST['go'];
if ($act == 'redb') {
    if ($go == count($info['file'])) {
        $fields = array('username' => $info['data']['adminuser'], 'realname' => $info['data']['adminuser'], 'password' => md5($info['data']['adminpwd']), 'email' => $info['data']['mail'], 'access' => 9999, 'date_created' => time());
        $add = $nf_m->add($nf_m->db_prefix . 'user_table', $fields);
        unset($fields);
        $fields = array('user_id' => 1, 'group_id' => 1);
        $add = $nf_m->add($nf_m->db_prefix . 'user_main_table', $fields);
        unset($fields);
        $fields = array('vals' => $info['data']['webname'], 'opts' => $info['data']['webname']);
        $add = $nf_m->up($nf_m->db_prefix . 'config', $fields, 'CFG_NAME', 'keyword');
        unset($fields);
        $fields = array('vals' => aCslas($info['data']['hostname']), 'opts' => aCslas($info['data']['hostname']));
        $add = $nf_m->up($nf_m->db_prefix . 'config', $fields, 'CFG_HOST', 'keyword');
        cfg_write($nf_m->sele($nf_m->db_prefix . 'config', NULL, 'id asc, '));
        if (!file_exists(PJROOT . '/look.txt')) {
            file_put_contents(PJROOT . '/lock.txt', 'ok');
        }
        @unlink(RUNTIME . '/data.php');
        @unlink(RUNTIME . '/data_copy.php');
        echo '所有表已完成创建!';
        exit;
    }
    if ($info['file'][$go]) {
        $table = str_replace('#@_', $conn_cfg['DB_PREFIX'], $info['file'][$go]);
        $tb = str_replace('.bak', '', $table);
        $tablefile = PJDATA . '/' . $info['file'][$go];
        $data = $nf_d->getFile($tablefile);
        $arr_data = explode(";\r\n", $data);
        foreach ($arr_data as $t) {