Example #1
0
        $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) {
            $t = preg_replace("/`#@_(.+)?`/iu", '`' . $conn_cfg['DB_PREFIX'] . '$1`', $t);
            $t = preg_replace("/ENGINE=\\b.{2,}\\b DEFAULT CHARSET=\\S+/", 'ENGINE=MyISAM DEFAULT CHARSET=utf8', $t);
            $nf_m->add($t, NULL);
        }
        echo '表"' . $tb . '"创建成功!' . "\r\n";
    }
    exit;
} elseif ($act == 'put') {
    $serial = strval($_POST['serial']);
    $fields = array('vals' => $serial, 'opts' => $serial);
    $add = $nf_m->up($nf_m->db_prefix . 'config', $fields, 'CFG_APPID', 'keyword');
    unset($fields);
}