<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>配置设置</title>
<meta name="description" content="这是一个 index 页面">
<meta name="keywords" content="index">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="stylesheet" href="assets/css/amazeui.min.css"/>
<link rel="stylesheet" href="assets/css/admin.css">
<style>
form{margin:20px;}
input{margin-top:6px;width:300px;}
button{margin-top:16px;margin-right:20px;}
form span{width:100px;}
</style>
</head>
<body>
<?php if(@$_GET['action']!=1){ ?>
<form action="install.php?action=1" method="post">
<span>数据库服务器:</span><input type="text" name="host" value="localhost"><br />
<span>新建数据库名:</span><input type="text" name="db" value="xssong"><br />
<span>数据库用户名: </span><input type="text" name="user" value="root"><br />
<span>数据库密码:</span><input type="text" name="psw" value=""><br />
<span>网站域名:</span><input type="text" name="url" value="http://localhost/tt/"><br />
<span>OSS_ACCESS_ID:</span><input type="text" name="oss_access_id" value="ltXiRtWrIgtg1M4o"><br />
<span>OSS_ACCESS_KEY:</span><input type="text" name="oss_access_key" value="7SNcWno6Zg4NO4zEkwzjNvJTX2f3bh"><br />
<span>OSS_ENDPOINT:</span><input type="text" name="oss_endpoint" value="oss-cn-hangzhou.aliyuncs.com"><br />
<span>OSS_TEST_BUCKET:</span><input type="text" name="oss_test_bucket" value="xssong-test"><br />
<span>appid:</span><input type="text" name="appid" value="wx1358979afaef5c3c"><br />
<span>mchid:</span><input type="text" name="mchid" value="1343600901"><br />
<span>key:</span><input type="text" name="key" value="iOHkxaf5K53Wc3kGdLr12yBnlUwpnteT"><br />
<span>appsecret:</span><input type="text" name="appsecret" value="eb8481a8a56fbcf44883a78fccbd8a12"><br />

<button type="reset" class="am-btn am-btn-warning">重置</button>
<button type="submit" class="am-btn am-btn-primary">提交</button>
</form>
<?php
}else{
$lockfile = "install.lock";
if($_POST['host']!="" && $_POST['user']!="" && $_POST['db']!=""){
$host = $_POST['host'];
$user = $_POST['user'];
$psw = $_POST['psw'];
$db = $_POST['db'];
$url = $_POST['url'];
$oss_access_id = $_POST['oss_access_id'];
$oss_access_key = $_POST['oss_access_key'];
$oss_endpoint = $_POST['oss_endpoint'];
$oss_test_bucket = $_POST['oss_test_bucket'];
$appid = $_POST['appid'];
$mchid = $_POST['mchid'];
$key = $_POST['key'];
$appsecret = $_POST['appsecret'];
}
if(file_exists($lockfile)){
exit("已经安装过了,如果要重新安装请先删除install.lock");
}
$link = mysql_connect($host,$user,$psw);
if($link){
$sql_drop_db = "Drop DATABASE IF EXISTS `".$db."`";
$sql_create_db = "Create DATABASE `".$db."`";
require 'jtx.php';
}
mysql_query($sql_drop_db,$link);
mysql_query($sql_create_db,$link);
mysql_query("use $db",$link);
foreach($sql_create_table as $k=>$v){
mysql_query($v,$link);
}

//全局变量配置文件
$config_file = "selfconfig.php";
$config_content = "<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\n";
$config_content .= "\$config['base_url'] = '".$url."';\n";
// $config_content .= "\$config['hostname'] = '".$host."';\n";
// $config_content .= "\$config['username'] = '".$user."';\n";
// $config_content .= "\$config['password'] = '".$psw."';\n";
// $config_content .= "\$config['database'] = '".$db."';\n";
$config_content .= "\$config['appid'] = '".$appid."';\n";
$config_content .= "\$config['mchid'] = '".$mchid."';\n";
$config_content .= "\$config['key'] = '".$key."';\n";
$config_content .= "\$config['appsecret'] = '".$appsecret."';\n";

//数据库配置文件
$dbname = "database.php";
$db_content = "<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\n";
$db_content .= "\$active_group = 'default';\n";
$db_content .= "\$query_builder = TRUE;\n";
$db_content .= "\$db['default']['hostname'] ='".$host."';\n";
$db_content .= "\$db['default']['username'] ='".$user."';\n";
$db_content .= "\$db['default']['password'] ='".$psw."';\n";
$db_content .= "\$db['default']['database'] ='".$db."';\n";
$db_content .= "\$db['default']['dbdriver'] = 'mysql';\n";
$db_content .= "\$db['default']['dbprefix'] = '';\n";
$db_content .= "\$db['default']['pconnect'] = TRUE;\n";
$db_content .= "\$db['default']['db_debug'] = TRUE;\n";
$db_content .= "\$db['default']['cache_on'] = FALSE;\n";
$db_content .= "\$db['default']['cachedir'] = '';\n";
$db_content .= "\$db['default']['char_set'] = 'utf8';\n";
$db_content .= "\$db['default']['dbcollat'] = 'utf8_general_ci';\n";
$db_content .= "\$db['default']['swap_pre'] = '';\n";
$db_content .= "\$db['default']['autoinit'] = TRUE;\n";
$db_content .= "\$db['default']['stricton'] = FALSE;\n";

//阿里云配置文件
$oss_config = "Config.php";
$oss_content = "<?php\n";
$oss_content .= "final class Config{\n";
$oss_content .= "const OSS_ACCESS_ID = '".$oss_access_id."';\n";
$oss_content .= "const OSS_ACCESS_KEY = '".$oss_access_key."';\n";
$oss_content .= "const OSS_ENDPOINT = '".$oss_endpoint."';\n";
$oss_content .= "const OSS_TEST_BUCKET = '".$oss_test_bucket."';\n";
$oss_content .= "}";

$fp = fopen('application/config/'.$config_file,"wb");
fwrite($fp,$config_content);
fclose($fp);

$fp2 = fopen('application/config/'.$dbname,"wb");
fwrite($fp2,$db_content);
fclose($fp2);

$fp3 = fopen($lockfile,'w');
fwrite($fp3,'1212');
fclose($fp3);

$fp4 = fopen('aliyun-oss-php-sdk/'.$oss_config,"wb");
fwrite($fp4,$oss_content);
fclose($fp4);

echo '配置完毕';

}
?>
</body>
</html>

Install.php的更多相关文章

  1. OEL上使用yum install oracle-validated 简化主机配置工作

    环境:OEL 5.7 + Oracle 10.2.0.5 RAC 如果你正在用OEL(Oracle Enterprise Linux)系统部署Oracle,那么可以使用yum安装oracle-vali ...

  2. org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: jboss.jca:service=LocalTxCM,name=egmasDS

    17:34:37,235 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080 17:34:37,281 INFO [ ...

  3. 如何使用yum 下载 一个 package ?如何使用 yum install package 但是保留 rpm 格式的 package ? 或者又 如何通过yum 中已经安装的package 导出它,即yum导出rpm?

    注意 RHEL5 和 RHEL6 的不同 How to use yum to download a package without installing it Solution Verified - ...

  4. Install and Configure SharePoint 2013 Workflow

    这篇文章主要briefly introduce the Install and configure SharePoint 2013 Workflow. Microsoft 推出了新的Workflow ...

  5. Basic Tutorials of Redis(1) - Install And Configure Redis

    Nowaday, Redis became more and more popular , many projects use it in the cache module and the store ...

  6. Hadoop学习日志- install hadoop

    资料来源 : http://www.tutorialspoint.com/hadoop/hadoop_enviornment_setup.htm Hadoop 安装 创建新用户 $ su passwo ...

  7. 关于bundle install 的一点补充

    在第一次运行bundle install之后,生成了Gemfile.lock文件,里面记录gem的具体版本号,按照官方文档说明,以后运行bundle install就不会再依据Gemfile,而是根据 ...

  8. Centos 7 minimal install 无网络无ifconfig的解决

    Centos7这个比较不厚道, minimal install下居然不带net-tools 先要连上网络 修改/etc/sysconfig/network-scripts/ifcfg-ens12312 ...

  9. jBPM4.4 no jBPM DB schema: no JBPM4_EXECUTION table. Run the create.jbpm.schema target first in the install tool.

    jBPM4.4 no jBPM DB schema: no JBPM4_EXECUTION table. Run the create.jbpm.schema target first in the ...

  10. install hadoop on xubuntu

    0. install xubuntu we recommend to set username as "hadoop" after installation, set user & ...

随机推荐

  1. django快速搭建blog

    python版本:3.5.4: Django版本:2.0 创建项目 创建mysite项目和 blog应用: django-admin startproject mysite # 创建mysite项目 ...

  2. Comet OJ - Contest #7 D 机器学习题 斜率优化 + 未调完

    Code: #include <cstdio> #include <algorithm> #include <cstring> #define setIO(s) f ...

  3. 牛客网 珂学送分( 期望DP )

    题意 : 题目链接 分析 : 听队友说一般概率从前往后推.期望从后往前推......... #include<bits/stdc++.h> using namespace std; ; d ...

  4. Windows上安装Apache

    1.下载 (1)进入Apache官网http://httpd.apache.org— (2)点击Download (3)点击Files for Microsoft Windows (4)点击Apach ...

  5. Oracle In子句

    Oracle In子句 作者:初生不惑 Oracle基础 评论:0 条 Oracle技术QQ群:175248146 在本教程中,您将学习如何使用Oracle IN运算符来确定值是否与列表或子查询中的任 ...

  6. [CSP-S模拟测试]:毛二琛(DP)

    题目描述 $MYC$在$NOI2018$中,遇到了$day1T2$这样一个题,题目是让你求有多少“好”的排列.$MYC$此题没有获得高分,感到非常惭愧,于是回去专心研究排列了.如今数排列的题对$MYC ...

  7. iView 实战系列教程(21课时)_2.iView 实战教程之导航、路由、鉴权篇

    在c盘创建一个iview-router的项目 . 然后使用默认的配置 跳过 添加vue-router的插件 编译我们的文件. 编译好之后,我们启动App 默认的页面就打开了. 默认两个路由一个是abo ...

  8. 阶段1 语言基础+高级_1-3-Java语言高级_1-常用API_1_第5节 String类_4_字符串的比较相关方法

    字符串的常用方法 equals是对内容的比较 直接用字符串.equals 小写的h和大写的H肯定是不一样的 推荐和不推荐的写法 运行程序不会报任何的错误 如果把str5设置为null.那么推荐的写法返 ...

  9. windows7 玩 WinKawaks kof2002为什么提示couldn't initialise DirectSound?

    插上 耳机  或者 音响 就ok 呵呵 http://wenwen.sogou.com/z/q200172744.htm windows7 玩 WinKawaks kof2002为什么提示couldn ...

  10. Numpy 基础函数

    日后用的着的时候再说,存下来.方便日后查看 NumPy数组使你可以将许多种数据处理任务表述为简洁的数组表达式(否则需要编写循环).用数组表达式代替循环的做法,通常被称为矢量化. 原来一直不明白什么叫矢 ...