Example #1
0
}
$admin_name = isset($_POST['admin_name']) ? json_str_iconv(trim($_POST['admin_name'])) : 'admin';
$admin_password = isset($_POST['password']) ? trim($_POST['password']) : '549c6dd086d5c7127745';
//ecshop123654
$admin_password2 = isset($_POST['admin_password2']) ? trim($_POST['admin_password2']) : '549c6dd086d5c7127745';
$admin_email = isset($_POST['admin_email']) ? trim($_POST['admin_email']) : '';
$result = create_admin_passport($admin_name, $admin_password, $admin_password2, $admin_email);
if ($result === false) {
    data_back('创建管理员失败');
}
$system_lang = isset($_POST['system_lang']) ? $_POST['system_lang'] : 'zh_cn';
$captcha = isset($_POST['disable_captcha']) ? intval($_POST['disable_captcha']) : '0';
$install_demo = isset($_POST['data']) ? $_POST['data'] : 1;
$integrate = isset($_POST['userinterface']) ? trim($_POST['userinterface']) : 'ecshop';
$goods_types = empty($install_demo) ? array() : array('book', 'book', 'movie', 'mobile', 'notebook', 'dc', 'dv', 'cosmetics', 'mobile2');
$result = do_others($system_lang, $captcha, $goods_types, $install_demo, $integrate);
if ($result === false) {
    data_back('其他安装过程错误');
}
$result = deal_aftermath();
if ($result === false) {
    data_back('善后处理失败');
} else {
    @unlink(ROOT_PATH . 'data/config_temp.php');
    data_back('install succ', 'true');
}
function data_back($msg, $result = 'false')
{
    $data_arr = array('res' => $result, 'rsp' => $msg);
    $json = new JSON();
    die($json->encode($data_arr));
 function do_others()
 {
     $db_host = isset($_POST['db_host']) ? trim($_POST['db_host']) : '';
     $db_user = isset($_POST['db_user']) ? trim($_POST['db_user']) : '';
     $db_pass = isset($_POST['db_pass']) ? trim($_POST['db_pass']) : '';
     $db_name = isset($_POST['db_name']) ? trim($_POST['db_name']) : '';
     $system_lang = isset($_POST['system_lang']) ? $_POST['system_lang'] : 'zh_cn';
     $captcha = isset($_POST['disable_captcha']) ? intval($_POST['disable_captcha']) : '0';
     $goods_types = isset($_POST['goods_types']) ? $_POST['goods_types'] : array();
     $install_demo = isset($_POST['install_demo']) ? $_POST['install_demo'] : 0;
     $install_lang = isset($_POST['install_lang']) ? $_POST['install_lang'] : 0;
     $integrate = isset($_POST['userinterface']) ? trim($_POST['userinterface']) : 'ecshop';
     $result = do_others($db_host, $db_user, $db_pass, $db_name, $system_lang, $captcha, $goods_types, $install_demo, $install_lang, $integrate);
     if ($result === false) {
         echo "do_others erro";
     } else {
         echo 'OK';
     }
     exit;
 }