diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 00000000..54183254 Binary files /dev/null and b/favicon.ico differ diff --git a/index.php b/index.php new file mode 100644 index 00000000..b24d302e --- /dev/null +++ b/index.php @@ -0,0 +1,29 @@ + +// +---------------------------------------------------------------------- + +// 检测PHP环境 +if(version_compare(PHP_VERSION,'5.5.5','<')) die('require PHP > 5.5.5 !'); +//error_reporting(E_ALL ^ E_NOTICE);//显示除去 E_NOTICE 之外的所有错误信息 +error_reporting(E_ERROR | E_WARNING | E_PARSE);//报告运行时错误 +//检测是否已安装CrmEb系统 +if(file_exists("./install/") && !file_exists("./install/install.lock")){ + if($_SERVER['PHP_SELF'] != '/index.php'){ + header("Content-type: text/html; charset=utf-8"); + exit("请在域名根目录下安装,如:
www.xxx.com/index.php 正确
www.xxx.com/www/index.php 错误,域名后面不能圈套目录, 但项目没有根目录存放限制,可以放在任意目录,apache虚拟主机配置一下即可"); + } + header('Location:/install/index.php'); + exit(); +} +// [ 应用入口文件 ] +// 定义应用目录 +define('APP_PATH', __DIR__ . '/application/'); +// 加载框架引导文件 +require __DIR__ . '/thinkphp/start.php'; diff --git a/mysql.php b/mysql.php new file mode 100644 index 00000000..e9ffad61 --- /dev/null +++ b/mysql.php @@ -0,0 +1,152 @@ + +// +---------------------------------------------------------------------- +//访问方法 /mysql.php?pwd=******&table=表名为空所有表 +session_start(); +header("Content-type:text/html;charset=utf-8"); + +/** + * 生成mysql数据字典 + */ +// 配置数据库 +$database = array(); +$password = '327677';//访问密码GET['pwd'] 传输 +$database['DB_HOST'] = '127.0.0.1'; +$database['DB_NAME'] = 'shopcrmeb';//数据库名称 +$database['DB_USER'] = 'shopcrmeb';//用户名 +$database['DB_PWD'] = '5FYGH5d6zWZffrmA';//密码 +$char_set = 'UTF8';//数据库编码 +date_default_timezone_set('Asia/Shanghai'); +$mysql_conn = @mysqli_connect("{$database['DB_HOST']}", "{$database['DB_USER']}", "{$database['DB_PWD']}") or die("Mysql connect is error."); +mysqli_select_db($mysql_conn,$database['DB_NAME']); +$result = mysqli_query($mysql_conn,'show tables'); +mysqli_query($mysql_conn,'SET NAMES '.$char_set); + +$pwd = !empty($_GET['pwd'])?$_GET['pwd']:$_SESSION['pwd']; +if($password != $pwd)exit('无权访问'); +$_SESSION['pwd'] = $pwd; + +if($_GET['table']) +{ + $tables[]['TABLE_NAME'] = $_GET['table']; +}else{ + // 取得所有表名 + while ($row = mysqli_fetch_array($result)) + { + $tables[]['TABLE_NAME'] = $row[0]; + } +} +// 循环取得所有表的备注及表中列消息 +foreach($tables as $k => $v) +{ + $sql = 'SELECT * FROM '; + $sql .= 'INFORMATION_SCHEMA.TABLES '; + $sql .= 'WHERE '; + $sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database['DB_NAME']}'"; + $table_result = mysqli_query($mysql_conn,$sql); + while ($t = mysqli_fetch_array($table_result)) + { + $tables[$k]['TABLE_COMMENT'] = $t['TABLE_COMMENT']; + } + $sql = 'SELECT * FROM '; + $sql .= 'INFORMATION_SCHEMA.COLUMNS '; + $sql .= 'WHERE '; + $sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database['DB_NAME']}'"; + $fields = array(); + $field_result = mysqli_query($mysql_conn,$sql); + while ($t = mysqli_fetch_array($field_result)) + { + $fields[] = $t; + } + $tables[$k]['COLUMN'] = $fields; +} +mysqli_close($mysql_conn); +//print_r($tables); +$html = ''; +if(isset($_GET['table'])) +{ + $html .= '

表结构

'; + $html .= '

生成时间:' . date('Y-m-d H:i:s') . '

'; + // 循环所有表 + foreach($tables as $k => $v) + { + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + foreach($v['COLUMN'] AS $f) + { + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + } + $html .= '
表名:' . $v['TABLE_NAME'] . ' ------- ' . $v['TABLE_COMMENT'] . '
字段名数据类型默认值允许非空自动递增备注
' . $f['COLUMN_NAME'] . '' . $f['COLUMN_TYPE'] . '' . $f['COLUMN_DEFAULT'] . '' . $f['IS_NULLABLE'] . '' . ($f['EXTRA'] == 'auto_increment'?'是':' ') . '' . $f['COLUMN_COMMENT'] . '

'; + $html .= '

总共:' . count($v['COLUMN']) . '个字段

'; + $html .= ''; + } +}else{ + $html .= '

数据字典

'; + $html .= '

生成时间:' . date('Y-m-d H:i:s') . '

'; + foreach($tables as $k => $v) + { + $html .= ''; + $html .= ''; + + + $html .= '
表名:' . $v['TABLE_NAME'] . ' ------- ' . $v['TABLE_COMMENT'] . '[查看结构]

'; + } + $html .= '

总共:' . count($tables) . '个数据表

'; + $html .= ''; +} +// 输出 +echo ' + + '.$_GET["table"].' + + '; + +echo $html; + +?> + + + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..b8c52753 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,5 @@ +location / { + if (!-e $request_filename){ + rewrite ^(.*)$ /index.php?s=$1 last; break; + } +} \ No newline at end of file diff --git a/router.php b/router.php new file mode 100644 index 00000000..5ead7480 --- /dev/null +++ b/router.php @@ -0,0 +1,19 @@ + +// +---------------------------------------------------------------------- +// $Id$ + +//router.php用于php自带webserver支持,可用于快速测试,这取决于你的入口文件和配置参数。 + +if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["REQUEST_URI"])) { + return false; +} else { + require __DIR__ . "/index.php"; +}