更新 v1.8.0版本

This commit is contained in:
LyLme 2023-12-16 17:20:06 +08:00
parent c66b0320e2
commit 350410f35b
10 changed files with 297 additions and 276 deletions

View File

@ -2,7 +2,7 @@
include("../include/common.php"); include("../include/common.php");
if(isset($_POST['user']) && isset($_POST['pass'])) { if(isset($_POST['user']) && isset($_POST['pass'])) {
$user = daddslashes($_POST['user']); $user = daddslashes($_POST['user']);
$pass=daddslashes($_POST['pass']); $pass = md5('lylme' . daddslashes($_POST['pass']));
if($user == $conf['admin_user'] && $pass == $conf['admin_pwd']) { if($user == $conf['admin_user'] && $pass == $conf['admin_pwd']) {
$session = md5($user . $pass); $session = md5($user . $pass);
$token = authcode("{$user}\t{$session}", 'ENCODE', SYS_KEY); $token = authcode("{$user}\t{$session}", 'ENCODE', SYS_KEY);
@ -78,7 +78,8 @@ if(isset($_POST['user']) && isset($_POST['pass'])){
<?php <?php
if(!empty($background = background())) { if(!empty($background = background())) {
$background = str_replace('./', '../', $background); $background = str_replace('./', '../', $background);
echo '<div class="row lylme-wrapper" style="background-image: url('.$background.');background-size: cover;">';} echo '<div class="row lylme-wrapper" style="background-image: url(' . $background . ');background-size: cover;">';
}
?> ?>
<div class="row lyear-wrapper"> <div class="row lyear-wrapper">
<div class="lyear-login"> <div class="lyear-login">
@ -103,7 +104,7 @@ if(!empty($background = background())){
</form> </form>
<hr> <hr>
<footer class="col-sm-12 text-center"> <footer class="col-sm-12 text-center">
<p class="m-b-0">Copyright ©2021 - <?php echo(date('Y')); ?> <a href="/"><?php echo explode("-", $conf['title'])[0];?></a></p> <p class="m-b-0">Copyright <?php echo(date('Y')); ?> <a href="/"><?php echo explode("-", $conf['title'])[0];?></a></p>
</footer> </footer>
</div> </div>
</div> </div>

View File

@ -8,49 +8,36 @@ if($set=='save'){
$newpwd = $_POST['newpwd']; $newpwd = $_POST['newpwd'];
$repwd = $_POST['confirmpwd']; $repwd = $_POST['confirmpwd'];
if($oldpwd==$conf['admin_pwd']) if(md5('lylme' . $oldpwd) == $conf['admin_pwd']) {
{
if(empty($newpwd)) {//未修改密码 if(empty($newpwd)) {//未修改密码
if(empty($user)) if(empty($user)) {
{ echo '<script>alert("未做出更改");history.go(-1);</script>';
echo '<script>alert("未做出更改");history.go(-1);</script>';//只修改用户名 } else {
} //只修改用户名
else
{
saveSetting('admin_user', $user); saveSetting('admin_user', $user);
echo '<script>alert("用户名修改成功!\n新用户名' . $user . '\n请牢记将重新登录");window.location.href="./";</script>'; echo '<script>alert("用户名修改成功!\n新用户名' . $user . '\n请牢记将重新登录");window.location.href="./";</script>';
} }
} } elseif(!empty($newpwd)) {//修改密码
else if(!empty($newpwd)) if ($newpwd == $repwd && empty($user)) {
{//修改密码 $admin_pwd = md5('lylme' . $newpwd);
if ($newpwd==$repwd && empty($user)) saveSetting('admin_pwd', $admin_pwd);
{
saveSetting('admin_pwd',$newpwd);
echo '<script>alert("密码修改成功!\n新密码' . $newpwd . '\n请牢记将重新登录");window.location.href="./";</script>'; echo '<script>alert("密码修改成功!\n新密码' . $newpwd . '\n请牢记将重新登录");window.location.href="./";</script>';
} } elseif($newpwd == $repwd) {
else if($newpwd==$repwd) $admin_pwd = md5('lylme' . $newpwd);
{
saveSetting('admin_user', $user); saveSetting('admin_user', $user);
saveSetting('admin_pwd',$newpwd); saveSetting('admin_pwd', $admin_pwd);
echo '<script>alert("修改成功!\n新用户名' . $user . '\n新密码' . $newpwd . '\n请牢记将重新登录");window.location.href="./";</script>'; echo '<script>alert("修改成功!\n新用户名' . $user . '\n新密码' . $newpwd . '\n请牢记将重新登录");window.location.href="./";</script>';
} }
} } else {
else
{
echo '<script>alert("两次新密码不一致!");history.go(-1);</script>'; echo '<script>alert("两次新密码不一致!");history.go(-1);</script>';
} }
} } else {
else{
echo '<script>alert("当前密码错误!");history.go(-1);</script>'; echo '<script>alert("当前密码错误!");history.go(-1);</script>';
} }
} } else {
else{
?> ?>
<!--页面主要内容--> <!--页面主要内容-->

View File

@ -1,35 +1,42 @@
<?php <?php
@header("Content-type:text/html;charset=utf-8"); @header("Content-type:text/html;charset=utf-8");
define('IN_CRONLITE', true); define('IN_CRONLITE', true);
define('SYS_KEY', 'lylme_key'); define('SYS_KEY', 'lylme_key');
define('SYSTEM_ROOT', dirname(__FILE__) . '/'); define('SYSTEM_ROOT', dirname(__FILE__) . '/');
define('ROOT', dirname(SYSTEM_ROOT) . '/'); define('ROOT', dirname(SYSTEM_ROOT) . '/');
error_reporting(0); //error_reporting(0);
require ROOT . 'config.php'; require ROOT . 'config.php';
if(!defined('SQLITE') && (!$dbconfig['user']||!$dbconfig['pwd']||!$dbconfig['dbname'])) if(!defined('SQLITE') && (!$dbconfig['user'] || !$dbconfig['pwd'] || !$dbconfig['dbname'])) {
{
@unlink(ROOT . 'install/install.lock'); @unlink(ROOT . 'install/install.lock');
header('Content-type:text/html;charset=utf-8'); header("Location:");
echo '你还没安装!<a href="install/">点此安装</a>';
exit(); exit();
} }
include_once(SYSTEM_ROOT."db.class.php"); require SYSTEM_ROOT . "db.class.php";
$DB = new DB($dbconfig['host'], $dbconfig['user'], $dbconfig['pwd'], $dbconfig['dbname'], $dbconfig['port']); $DB = new DB($dbconfig['host'], $dbconfig['user'], $dbconfig['pwd'], $dbconfig['dbname'], $dbconfig['port']);
$rs= $DB->query("SELECT * FROM `lylme_config`"); $web_config = $DB->query("SELECT * FROM `lylme_config`");
while($row = $DB->fetch($rs)) $conf[$row['k']]=$row['v']; while($row = $DB->fetch($web_config)) {
include_once(SYSTEM_ROOT."lists.php"); $conf[$row['k']] = $row['v'];
include_once(SYSTEM_ROOT."function.php"); }
include_once(SYSTEM_ROOT."member.php"); require SYSTEM_ROOT . "lists.php";
include_once(SYSTEM_ROOT."tj.php"); require SYSTEM_ROOT . "function.php";
include_once(SYSTEM_ROOT."version.php"); require SYSTEM_ROOT . "member.php";
include_once(SYSTEM_ROOT."updbase.php"); require SYSTEM_ROOT . "tj.php";
$linksrows=$DB->num_rows($DB->query("SELECT * FROM `lylme_links`")); require SYSTEM_ROOT . "version.php";
$groupsrows=$DB->num_rows($DB->query("SELECT * FROM `lylme_groups`")); require SYSTEM_ROOT . "updbase.php";
require SYSTEM_ROOT . "site.php";
$cdnpublic = cdnpublic($conf['cdnpublic']); $cdnpublic = cdnpublic($conf['cdnpublic']);
$templatepath = './template/' . $conf["template"]; $templatepath = './template/' . $conf["template"];
$template = $templatepath . '/index.php'; $template = $templatepath . '/index.php';
$background = $conf["background"]; $background = $conf["background"];
$wap_background = $conf["wap_background"]; $wap_background = $conf["wap_background"];
if(checkmobile()){if(!empty($wap_background)){$background_img = $wap_background;} if(checkmobile()) {
else{$background_img = $background; }}else{$background_img = $background; } if(!empty($wap_background)) {
?> $background_img = $wap_background;
} else {
$background_img = $background;
}
} else {
$background_img = $background;
}

View File

@ -1,4 +1,5 @@
<?php <?php
if(!empty($_GET['url'])) { if(!empty($_GET['url'])) {
$url = $_GET['url']; $url = $_GET['url'];
header("Location:$url"); header("Location:$url");
@ -8,33 +9,31 @@ include("common.php");
session_start(); //设置session session_start(); //设置session
if($_POST['exit'] == 'exit') { if($_POST['exit'] == 'exit') {
//注销登录 //注销登录
$_SESSION['pass'] = 0; $_SESSION['pass'] = null;
$_SESSION['list'] = array(); $_SESSION['list'] = array();
header("Location: " . $_SERVER['HTTP_REFERER']); header("Location: " . $_SERVER['HTTP_REFERER']);
exit(); exit('注销登录成功');
} }
@$pass = daddslashes($_POST['pass']);
if($_SESSION['pass'] != 1) { if($_SESSION['pass'] != 1) {
//未登录 //未登录
$pass = daddslashes($_POST['pass']);
if(!empty($pass)) { if(!empty($pass)) {
//用户提交登录 //用户提交登录
$show = array(); $show = array();
$pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '" . $pass . "';"); $pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '" . $pass . "';");
while ($pwd = $DB->fetch($pwds)) { while ($pwd = $DB->fetch($pwds)) {
array_push($show,$pwd[pwd_id]); array_push($show, $pwd['pwd_id']);
} }
if(empty($show)) { if(empty($show)) {
//无数据 //无数据
exit('<script>alert("密码错误!");window.location.href="' . $_SERVER['HTTP_REFERER'] . '";</script>'); exit('<script>alert("密码错误!");window.location.href="' . $_SERVER['HTTP_REFERER'] . '";</script>');
} } else {
else{
//有数据 //有数据
$_SESSION['list'] = $show; $_SESSION['list'] = $show;
$_SESSION['pass'] = 1; $_SESSION['pass'] = 1;
} }
} }
} } else {
else {
//已登录 //已登录
if(!empty($pass)) { if(!empty($pass)) {
$show = array(); $show = array();
@ -43,11 +42,12 @@ else {
array_push($show, $pwd['pwd_id']); array_push($show, $pwd['pwd_id']);
} }
if(empty($show)) { if(empty($show)) {
$_SESSION['pass'] = 0; $_SESSION['pass'] = null;
$_SESSION['list'] = array(); $_SESSION['list'] = array();
} }
} }
} }
if(basename($_SERVER['PHP_SELF']) != basename(__FILE__)) return; if(basename($_SERVER['PHP_SELF']) != basename(__FILE__)) {
return;
}
header("Location: ../"); header("Location: ../");
?>

3
include/site.php Normal file
View File

@ -0,0 +1,3 @@
<?php
class site {}

View File

@ -1,9 +1,11 @@
<?php <?php
$linksrows = $DB->num_rows($DB->query("SELECT * FROM `lylme_links`")); //链接数量
$groupsrows = $DB->num_rows($DB->query("SELECT * FROM `lylme_groups`")); //分类数量
$file = SYSTEM_ROOT . "/log.txt"; $file = SYSTEM_ROOT . "/log.txt";
if(!file_exists($file)) { if(!file_exists($file)) {
touch($file); touch($file);
} } else {
else{
$fp = fopen($file, 'r+'); $fp = fopen($file, 'r+');
$content = ''; $content = '';
if (flock($fp, LOCK_EX)) { if (flock($fp, LOCK_EX)) {
@ -29,8 +31,7 @@ if(strpos($_SERVER['REQUEST_URI'],'admin')==false){
ftruncate($fp, 0); // 将文件截断到给定的长度 ftruncate($fp, 0); // 将文件截断到给定的长度
rewind($fp); // 倒回文件指针的位置 rewind($fp); // 倒回文件指针的位置
fwrite($fp, serialize($tongji)); fwrite($fp, serialize($tongji));
} } else {
else{
$tongji[$tjtotal] = $tjdate[$tjtotal] ; $tongji[$tjtotal] = $tjdate[$tjtotal] ;
// 本月访问量增加 // 本月访问量增加
$tongji[$tjmonth] = $tjdate[$tjmonth]; $tongji[$tjmonth] = $tjdate[$tjmonth];
@ -49,4 +50,3 @@ if(strpos($_SERVER['REQUEST_URI'],'admin')==false){
//访总问 {$tjtotal} 本月 {$tjmonth} 昨日 {$tjyesterday} 今日 {$tjtoday} //访总问 {$tjtotal} 本月 {$tjmonth} 昨日 {$tjyesterday} 今日 {$tjtoday}
} }
} }
?>

View File

@ -1,6 +1,10 @@
<?php <?php
if(empty(constant("VERSION")))return 0;
function get_vernum($version){ if(empty(constant("VERSION"))) {
return 0;
}
function get_vernum($version)
{
$vn = explode('.', str_replace('v', '', $version)); $vn = explode('.', str_replace('v', '', $version));
$vernum = $vn[0] . sprintf("%02d", $vn[1]) . sprintf("%02d", $vn[2]); $vernum = $vn[0] . sprintf("%02d", $vn[1]) . sprintf("%02d", $vn[2]);
return $vernum; return $vernum;
@ -12,7 +16,7 @@ if($sqlvn < $filevn){
$sql = ''; $sql = '';
if($sqlvn < 10101) { if($sqlvn < 10101) {
$version = 'v1.1.1'; $version = 'v1.1.1';
$sql = $sql.file_get_contents(ROOT.'install/update.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update.sql');
} }
if($sqlvn < 10103) { if($sqlvn < 10103) {
$version = 'v1.1.3'; $version = 'v1.1.3';
@ -20,26 +24,26 @@ if($sqlvn < 10103) {
@unlink(ROOT . 'include/home.php'); @unlink(ROOT . 'include/home.php');
@unlink(ROOT . 'include/apply.php'); @unlink(ROOT . 'include/apply.php');
@unlink(ROOT . 'include/footer.php'); @unlink(ROOT . 'include/footer.php');
$sql = $sql.file_get_contents(ROOT.'install/update1.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update1.sql');
} }
if($sqlvn < 10104) { if($sqlvn < 10104) {
$version = 'v1.1.4'; $version = 'v1.1.4';
} }
if($sqlvn < 10105) { if($sqlvn < 10105) {
$version = 'v1.1.5'; $version = 'v1.1.5';
$sql = $sql.file_get_contents(ROOT.'install/update2.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update2.sql');
} }
if($sqlvn < 10106) { if($sqlvn < 10106) {
$version = 'v1.1.6'; $version = 'v1.1.6';
$sql = $sql.file_get_contents(ROOT.'install/update3.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update3.sql');
} }
if($sqlvn < 10109) { if($sqlvn < 10109) {
$version = 'v1.1.9'; $version = 'v1.1.9';
$sql = $sql.file_get_contents(ROOT.'install/update4.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update4.sql');
} }
if($sqlvn < 10200) { if($sqlvn < 10200) {
$version = 'v1.2.0'; $version = 'v1.2.0';
$sql = $sql.file_get_contents(ROOT.'install/update5.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update5.sql');
} }
if($sqlvn < 10205) { if($sqlvn < 10205) {
$version = 'v1.2.5'; $version = 'v1.2.5';
@ -55,18 +59,31 @@ if($sqlvn < 10500) {
} }
if($sqlvn < 10501) { if($sqlvn < 10501) {
$version = 'v1.5.1'; $version = 'v1.5.1';
$sql = $sql.file_get_contents(ROOT.'install/update6.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update6.sql');
} }
if($sqlvn < 10600) { if($sqlvn < 10600) {
$version = 'v1.6.0'; $version = 'v1.6.0';
$sql = $sql.file_get_contents(ROOT.'install/update7.sql'); $sql = $sql . file_get_contents(ROOT . 'install/data/update7.sql');
} }
if($sqlvn < 10700) { if($sqlvn < 10700) {
$version = 'v1.7.0'; $version = 'v1.7.0';
} }
if($sqlvn < 10800) {
$version = 'v1.8.0';
$sql = $sql . file_get_contents(ROOT . 'install/data/update8.sql');
if (!isset($conf['md5pass'])) {
//MD5加密密码
$admin_pwd = md5('lylme' . $conf['admin_pwd']);
$DB->query("INSERT INTO `lylme_config` (`k`, `v`, `description`) VALUES ('md5pass', '1', '启用md5加密密码');");
saveSetting('admin_pwd', $admin_pwd);
}
}
$sql = explode(';', $sql); $sql = explode(';', $sql);
for ($i = 0;$i < count($sql);$i++) { for ($i = 0;$i < count($sql);$i++) {
if (trim($sql[$i])=='')continue; if (trim($sql[$i]) == '') {
continue;
}
if($DB->query($sql[$i])) { if($DB->query($sql[$i])) {
} }
} }

View File

@ -1,3 +1,3 @@
<?php <?php
define('VERSION', '1.7.0');
?> define('VERSION', '1.8.0');

View File

@ -1,9 +1,11 @@
<?php <?php
@header('Content-Type: text/html; charset=UTF-8'); @header('Content-Type: text/html; charset=UTF-8');
if (!file_exists('install/install.lock')) if (!file_exists('install/install.lock')) {
exit('<title>安装程序</title>您还未安装,点击<a href="install"><font color="blue">这里</font></a>开始安装!'); header("Location:/install");
include "./include/common.php"; exit();
}
require "./include/common.php";
session_start(); //设置session session_start(); //设置session
$_SESSION['list'] = isset($_SESSION['list']) ? $_SESSION['list'] : array(); $_SESSION['list'] = isset($_SESSION['list']) ? $_SESSION['list'] : array();
include $template; require $template;
?>

View File

@ -36,19 +36,21 @@ and (max-width:320px){.form-wrapper{padding-top:10%;border-radius:2px;margin:50p
if(!empty($background = background())) { if(!empty($background = background())) {
$background = str_replace('./', '../', $background); $background = str_replace('./', '../', $background);
echo '<div class="body" style="background-image: url('.$background.');">';} echo '<div class="body" style="background-image: url(' . $background . ');">';
}
?> ?>
<div class="form-wrapper"> <div class="form-wrapper">
<div class="nav"> <div class="nav">
<?php <?php
if($DB->num_rows($DB->query("SELECT * FROM `lylme_pwd`"))!=0){echo '<h1>访问管理</h1>';?> if($DB->num_rows($DB->query("SELECT * FROM `lylme_pwd`")) != 0) {
echo '<h1>访问管理</h1>';?>
</div> </div>
<?php <?php
session_start(); //设置session session_start(); //设置session
if($_SESSION['pass'] != 1){?> if(isset($_SESSION['pass']) != 1) {?>
<p>请输入密码登录</p> <p>请输入密码登录</p>
<form name="form" action="../include/go.php" method="POST"> <form name="form" action="../include/go.php" method="POST">
<div class="form"> <div class="form">
@ -79,7 +81,9 @@ if(!empty($background = background())){
</form> </form>
<?php <?php
} }
}else{echo '<h2>当前站点未启用链接加密</h2>';} } else {
echo '<h2>当前站点未启用链接加密</h2>';
}
?> ?>
<a href="../" class="home">返回首页</a> <a href="../" class="home">返回首页</a>
</div> </div>