Install.php

<!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/[email protected]">
<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>

时间: 2024-12-14 18:04:58

Install.php的相关文章

Install Hyper-V on Windows 10

? Enable Hyper-V to create virtual machines on Windows 10.Hyper-V can be enabled in many ways including using the Windows 10 control panel, PowerShell (my favorite) or using the Deployment Imaging Servicing and Management tool (DISM). This documents

Ubuntu16.04 install OpenJDK8

1.按Ctrl + Alt + T打开终端.打开后,运行下面的命令来添加PPA:sudo add-apt-repository ppa:openjdk-r/ppa 2.之后,更新系统包缓存并安装OpenJDK 8: sudo apt-get update sudo apt-get install openjdk-8-jdk 3.如果您的系统上安装了多个Java版本.运行下面的命令设置默认的Java:sudo update-alternatives --config java 键入一个数字以选择J

Install Adobe Flash Player 11.2 on CentOS/RHEL 7/6/5, Fedora 20/19

Adobe Flash Player are very useful for watching videos in web browser online. Without flash player most of the videos will not play in your browser. This article will help you to install Adobe flash player plugin for your browsers in CentOS 6/5, Redh

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

About LAMP LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here i

centos 6 oracle 11G DB install

因业务迁移,需重新部署oracle DB,此文仅作部署记录,部署文档主要参考官方文档http://docs.oracle.com/cd/E11882_01/install.112/e47689/toc.htm 概要: 主机:OpenStack 云主机 系统:Completing a Minimal Linux centos 6.8 x86_64 DB:Oracle Database 11g Release 2(11.2) 内存:2Gb 硬盘:/dev/vda 20Gb /dev/vdb 30Gb

nginx install

wget http://nginx.org/download/nginx-1.11.1.tar.gz tar xf nginx-1.11.1.tar.gz cd nginx-1.11.1 搭建yum环境,解决nginx需要的开发包 挂载光盘 mount /dev/cdrom /mnt cd /etc/yum.repos.d/ vim Centos_86x64.repo [base] name=Centos_86x64 baseurl=file:///mnt/ enabled=1 gpgcheck

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

1.事件描述:CentOS7下使用tree命令,发现该命令没有被安装,在安装的过程中发现yum报错 [[email protected] ~]# tree -d bash: tree: 未找到命令... [[email protected] ~]# yum -y install tree 已加载插件:fastestmirror, langpacks Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

Install postfix on Ubuntu 14.04.txt

Ubuntu 14.04上安装和配置Postfix邮件服务详细教程 Postfix: 用来接受和发送邮件的邮件服务器,正确说法应该叫邮件传送代理(Mail Transfer Agent,MTA),是邮件服务最重要的部分:    Dovecot: POP 和 IMAP 服务器,用来管理本地邮件目录以便用户能通过 Mail.app, Thunderbird, Mutt 等邮件客户端(又叫邮件用户代理 Mail User Agent, MUA)登陆和下载邮件:    Postgrey: 邮件灰名单工具

pip install lxml 报错error: command ‘gcc‘ failed wit

install gcc install libxslt-devel libxml2-devel

How to install php 5.6.9 and apache httpd 2.4.12 on OEL6u6 x86 64bit

1. 安装apache httpd 2. 配置apache httpd 3. 安装php 5.6.9 4. 测试 1. 安装apache httpd # yum install apr apr-util # ls -l -rw-rw-r--. 1 NONE NONE 5054838 May 19 06:23 httpd-2.4.12.tar.bz2 # tar jxvf httpd-2.4.12.tar.bz2 # cd httpd-2.4.12 # ./configure --enable-m