mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
add automaticlly creating tables and remove some shit
This commit is contained in:
parent
f521781ac5
commit
51443b0a0a
10
admin/index.php
Normal file
10
admin/index.php
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Console - Blessing Skin Server 0.1</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Console</h2>
|
||||
</body>
|
||||
</html>
|
52
admin/install.php
Normal file
52
admin/install.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if (!file_exists("./install.lock")) {
|
||||
require "../config.php";
|
||||
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWD);
|
||||
|
||||
echo "<h2>Blessing Skin Server Install</h2>";
|
||||
|
||||
if (!$con) {
|
||||
die ("Can not connect to mysql, check if database info correct in config.php. ".mysql_error());
|
||||
} else {
|
||||
echo "Succesfully connected to mysql server.<br /><br />";
|
||||
}
|
||||
|
||||
if(!mysql_select_db(DB_NAME, $con)){
|
||||
die("Can not select database, please check if database '".DB_NAME."' really exists.");
|
||||
}
|
||||
|
||||
echo "Selected database: ".DB_NAME."<br /><br />";
|
||||
|
||||
echo "Start creating tables... <br /><br />";
|
||||
|
||||
$query = "CREATE TABLE IF NOT EXISTS `users` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`admin` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`username` varchar(20) NOT NULL,
|
||||
`password` varchar(32) NOT NULL,
|
||||
`ip` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`uid`),
|
||||
UNIQUE KEY `uid` (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15;";
|
||||
|
||||
if(!mysql_query($query)) {
|
||||
die("Creating tables failed. ".mysql_error());
|
||||
}
|
||||
|
||||
/**
|
||||
* username: admin
|
||||
* password: 123456
|
||||
*/
|
||||
mysql_query("INSERT INTO `users` (`uid`, `admin`, `username`, `password`, `ip`) VALUES(1, 1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '')");
|
||||
|
||||
echo "Successfully installed. <a href='../index.php'>Index</a>";
|
||||
|
||||
$lock = fopen("./install.lock", w) or die("Unable to write 'install.lock'.");
|
||||
fwrite($lock, time());
|
||||
fclose($lock);
|
||||
|
||||
} else {
|
||||
echo "It seems that you have already installed. <a href='../index.php'>Index</a><br /><br />";
|
||||
echo "May you should delete the file 'install.lock' in /admin to unlock installing.";
|
||||
}
|
||||
?>
|
@ -37,10 +37,12 @@ function changeForm(code){
|
||||
$("#confirm-passwd").show();
|
||||
$(".login-group").html('<button id="register" type="button" class="btn btn-default">Register</button>');
|
||||
window.history.pushState(null, null, "./index.php?action=register");
|
||||
document.title = "Register - Blessing Skin Server 0.1";
|
||||
} else {
|
||||
$(".login-title").html('Login');
|
||||
$("#confirm-passwd").hide();
|
||||
$(".login-group").html('<div class="checkbox-wrapper"><input id="keep" type="checkbox" class="checkbox"><label for="keep" class="checkbox-label"></label><span> Remember me</span></div><button id="login" type="button" class="btn btn-default">Log in</button>');
|
||||
window.history.pushState(null, null, "./index.php?action=login");
|
||||
document.title = "Login - Blessing Skin Server 0.1";
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ header('Access-Control-Allow-Origin:*');
|
||||
session_start();
|
||||
$action = $_GET['action'];
|
||||
require "./connect.php";
|
||||
global $arr;
|
||||
|
||||
if ($action == "login") {
|
||||
// SQL injection protection will be done in connect.php
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/* Blessing Skin Server 数据库的名称 */
|
||||
define('DB_NAME', '');
|
||||
define('DB_NAME', 'skin');
|
||||
|
||||
/* MySQL 数据库用户名 */
|
||||
define('DB_USER', '');
|
||||
define('DB_USER', 'root');
|
||||
|
||||
/* MySQL 数据库密码 */
|
||||
define('DB_PASSWD', '');
|
||||
define('DB_PASSWD', 'root');
|
||||
|
||||
/* MySQL 主机 */
|
||||
define('DB_HOST', 'localhost');
|
||||
|
@ -3,7 +3,7 @@ require "./config.php";
|
||||
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWD);
|
||||
|
||||
if (!$con) {
|
||||
die ("Can not connect to mysql, check if database info correct.".mysql_error());
|
||||
die ("Can not connect to mysql, check if database info correct in config.php. ".mysql_error());
|
||||
}
|
||||
mysql_select_db(DB_NAME, $con);
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
require "./connect.php";
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blessing Skin Server 0.1</title>
|
||||
<title>Index - Blessing Skin Server 0.1</title>
|
||||
<link rel="stylesheet" href="./libs/bootstrap/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="./assets/css/style.css">
|
||||
</head>
|
||||
|
@ -1,43 +0,0 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
--
|
||||
-- 主机: localhost
|
||||
-- 生成日期: 2016-01-03 14:15:15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- 数据库: `skin`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(20) NOT NULL,
|
||||
`password` varchar(32) NOT NULL,
|
||||
`ip` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`uid`),
|
||||
UNIQUE KEY `uid` (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
|
||||
|
||||
--
|
||||
-- 转存表中的数据 `users`
|
||||
--
|
||||
|
||||
INSERT INTO `users` (`uid`, `username`, `password`, `ip`) VALUES
|
||||
(1, 'admin', 'd29920ef0f3867b6b8fde12b9f2051db', '');
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
2
user.php
2
user.php
@ -5,7 +5,7 @@ if (!$_COOKIE["token"] && !$_COOKIE["uname"]) {
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blessing Skin Server 0.1</title>
|
||||
<title>Upload - Blessing Skin Server 0.1</title>
|
||||
<link rel="stylesheet" href="./libs/bootstrap/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="./assets/css/style.css">
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user