새로운 설치 코드 준비

This commit is contained in:
2018-03-17 21:21:44 +09:00
parent 7486ff3eec
commit 065107033b
7 changed files with 360 additions and 19 deletions
+67
View File
@@ -0,0 +1,67 @@
body, html{
height: 100%;
background-repeat: no-repeat;
}
.main{
margin-top: 70px;
}
h1.title {
font-size: 50px;
font-family: 'Passion One', cursive;
font-weight: 400;
}
hr{
width: 10%;
/*color: #fff;*/
}
.form-group{
margin-bottom: 15px;
}
label{
margin-bottom: 15px;
}
input,
input::-webkit-input-placeholder {
font-size: 11px;
padding-top: 3px;
}
.main-login{
/*background-color: #fff;*/
/* shadows and rounded borders */
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
.main-center{
margin-top: 30px;
margin: 0 auto;
max-width: 330px;
padding: 40px 40px;
}
.login-button{
margin-top: 5px;
}
.login-register{
font-size: 11px;
text-align: center;
}
.terms{
max-height: 200px; overflow: auto;
}
+67
View File
@@ -0,0 +1,67 @@
body, html{
height: 100%;
background-repeat: no-repeat;
}
.main{
margin-top: 70px;
}
h1.title {
font-size: 50px;
font-family: 'Passion One', cursive;
font-weight: 400;
}
hr{
width: 10%;
/*color: #fff;*/
}
.form-group{
margin-bottom: 15px;
}
label{
margin-bottom: 15px;
}
input,
input::-webkit-input-placeholder {
font-size: 11px;
padding-top: 3px;
}
.main-login{
/*background-color: #fff;*/
/* shadows and rounded borders */
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
.main-center{
margin-top: 30px;
margin: 0 auto;
max-width: 330px;
padding: 40px 40px;
}
.login-button{
margin-top: 5px;
}
.login-register{
font-size: 11px;
text-align: center;
}
.terms{
max-height: 200px; overflow: auto;
}
+17 -1
View File
@@ -15,7 +15,7 @@ function CustomHeader() {
header('Pragma: no-cache');
// header('Cache-Control: public');
// header('Pragma: public');
header('Content-Type: text/html; charset=utf-8');
// header('Content-Type: text/html; charset=utf-8');
}
//define(CURPATH, 'f_async');
//define(FILE, substr(strrchr(__FILE__, "\\"), 1));
@@ -26,6 +26,22 @@ function getmicrotime() {
return $microtimestmp[0] + $microtimestmp[1];
}
function logErrorByCustomHandler(int $errno , string $errstr, string $errfile, int $errline, array $errcontext){
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting, so let it fall
// through to the standard PHP error handler
return false;
}
$date = date("Ymd_His");
file_put_contents(__DIR__.'/../d_log/err_log.txt',"$date, $errno, $errstr, $errfile, $errline\n");
/* Don't execute PHP internal error handler */
return true;
}
set_error_handler("logErrorByCustomHandler");
function Error($msg) {
AppendToFile(ROOT.'/d_log/err.txt', $msg."\n");
exit(1);
+121 -13
View File
@@ -1,18 +1,126 @@
<?php
require_once('_common.php');
require('_common.php');
require(ROOT.'/f_func/class._Time.php');
use utilphp\util as util;
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>게임 시스템 설치 시작</title>
</head>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>설치</title>
<script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="../e_lib/bootstrap.bundle.min.js"></script>
<script src="../e_lib/jquery.validate.min.js"></script>
<script src="../e_lib/sha512.min.js"></script>
<script src="../js/install.js"></script>
<link type="text/css" rel="stylesheet" href="../e_lib/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="../css/install.css">
</head>
<body>
<div class="container">
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD 설치</h1>
<div class="row justify-content-md-center">
<body>
<form name=form1 action="install1.php" method=post>
<input type=submit value="설치시작" onclick="return confirm('회원 목록가 삭제됩니다!')">
</form>
</body>
<div class="col col-12 col-md-10 col-lg-7">
<div class="card" id="db_form_card" style="display:none">
<h3 class="card-header">
설치(DB 설정)
</h3>
<div class="card-body">
<form id="db_form" method="post" action="#">
<div class="form-group row">
<label for="db_host" class="col-sm-3 col-form-label">DB호스트</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_host" id="db_host" placeholder="호스트:포트" value="localhost" />
</div>
</div>
<div class="form-group row">
<label for="db_id" class="col-sm-3 col-form-label">DB계정명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정"/>
</div>
</div>
<div class="form-group row">
<label for="db_pw" class="col-sm-3 col-form-label">DB비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="db_pw" id="db_pw" placeholder="DB비밀번호"/>
</div>
</div>
<div class="form-group row">
<label for="db_name" class="col-sm-3 col-form-label">DB명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_name" id="db_name" placeholder="DB명(예:sammo)"/>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button>
</div>
</div>
</form>
</div>
</div><!--DB 폼 끝-->
<div class="card" id="admin_form_card" style="display:none">
<h3 class="card-header">
설치(관리자 생성)
</h3>
<div class="card-body">
<form id="admin_form" method="post" action="#">
<div class="form-group row">
<label for="username" class="col-sm-3 col-form-label">계정명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="username" id="username" placeholder="계정명"/>
</div>
</div>
<div class="form-group row">
<label for="password" class="col-sm-3 col-form-label">비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="password" id="password" placeholder="비밀번호"/>
</div>
</div>
<div class="form-group row">
<label for="confirm_password" class="col-sm-3 col-form-label">비밀번호 확인</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="confirm_password" id="confirm_password" placeholder="비밀번호 확인"/>
</div>
</div>
<div class="form-group row">
<label for="nickname" class="col-sm-3 col-form-label">닉네임</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="nickname" id="nickname" placeholder="닉네임"/>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">관리자 생성</button>
</div>
</div>
</form>
</div>
</div><!--ADMIN 폼 끝-->
</div>
</div>
</div>
</body>
</html>
+44
View File
@@ -0,0 +1,44 @@
<?php
require('_common.php');
require(__DIR__.'/../f_config/SETTING.php');
use utilphp\util as util;
session_start();
function dbConnFail($params){
returnJson([
'step'=>'conn_fail'
]);
}
function dbSQLFail($params){
returnJson([
'step'=>'sql_fail'
]);
}
if(!$SETTING->isExist()){
returnJson([
'step'=>'config'
]);
}
require(__DIR__.'/../f_config/DB.php');
$rootDB = getRootDB();
$rootDB->throw_exception_on_nonsql_error = false;
$rootDB->nonsql_error_handler = 'dbConnFail';
$rootDB->error_handler = 'dbSQLFail';
$memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from MEMBER');
if($memberCnt === 0){
returnJson([
'step'=>'admin'
]);
}
returnJson([
'step'=>'done'
]);
+1 -5
View File
@@ -1,8 +1,4 @@
<?php
require_once('_common.php');
?>
<!--<meta HTTP-EQUIV="refresh" CONTENT="0; URL=f_install/install.php">-->
Go to f_install/install.php<br>
Todo: Back to replace code
header('location:f_install/install.php');
+43
View File
@@ -0,0 +1,43 @@
function changeInstallMode(){
$.ajax({
cache:false,
type:'post',
url:'j_install_status.php',
dataType:'json',
}).then(function(result){
if(result.step == 'config'){
$('#db_form_card').show();
$('#admin_form_card').hide();
return;
}
if(result.step == 'admin'){
$('#db_form_card').hide();
$('#admin_form_card').show();
return;
}
if(result.step == 'done'){
alert('설치가 완료되었습니다.');
window.location.href = "..";
return;
}
if(result.step == 'conn_fail'){
$('#db_form_card').hide();
$('#admin_form_card').hide();
alert('설치 이후 DB 설정이 변경된 것 같습니다. conf.php 파일의 설정을 확인해주십시오.');
return;
}
if(result.step == 'sql_fail'){
$('#db_form_card').hide();
$('#admin_form_card').hide();
alert('DB가 제대로 설정되지 않았거나, 훼손된 것 같습니다. DB를 복구하거나 conf.php 파일을 삭제 후 재설치를 진행해 주십시오.');
return;
}
});
}
$(document).ready( function () {
changeInstallMode();
});