diff --git a/admin/login.php b/admin/login.php
index 0e693fe..bf64e2f 100644
--- a/admin/login.php
+++ b/admin/login.php
@@ -1,24 +1,24 @@
alert('登陆管理中心成功!');window.location.href='./';");
- }elseif ($pass != $conf['admin_pwd']) {
- @header('Content-Type: text/html; charset=UTF-8');
- exit("");
- }
-}elseif(isset($_GET['logout'])){
- setcookie("admin_token", "", time() - 604800);
- @header('Content-Type: text/html; charset=UTF-8');
- exit("");
-}elseif(isset($islogin)==1){
- exit("");
+if(isset($_POST['user']) && isset($_POST['pass'])) {
+ $user = daddslashes($_POST['user']);
+ $pass = md5('lylme' . daddslashes($_POST['pass']));
+ if($user == $conf['admin_user'] && $pass == $conf['admin_pwd']) {
+ $session = md5($user . $pass);
+ $token = authcode("{$user}\t{$session}", 'ENCODE', SYS_KEY);
+ setcookie("admin_token", $token, time() + 604800);
+ @header('Content-Type: text/html; charset=UTF-8');
+ exit("");
+ } elseif ($pass != $conf['admin_pwd']) {
+ @header('Content-Type: text/html; charset=UTF-8');
+ exit("");
+ }
+} elseif(isset($_GET['logout'])) {
+ setcookie("admin_token", "", time() - 604800);
+ @header('Content-Type: text/html; charset=UTF-8');
+ exit("");
+} elseif(isset($islogin) == 1) {
+ exit("");
}
?>
@@ -76,9 +76,10 @@ if(isset($_POST['user']) && isset($_POST['pass'])){
';}
+if(!empty($background = background())) {
+ $background = str_replace('./', '../', $background);
+ echo '';
+}
?>
@@ -103,7 +104,7 @@ if(!empty($background = background())){
diff --git a/admin/user.php b/admin/user.php
index c7d195b..8f98487 100644
--- a/admin/user.php
+++ b/admin/user.php
@@ -1,57 +1,44 @@
-alert("未做出更改");history.go(-1);';//只修改用户名
+$set = isset($_GET['set']) ? $_GET['set'] : null;
+if($set == 'save') {
+ $user = $_POST['new-usernameuser'];
+ $oldpwd = $_POST['oldpwd'];
+ $newpwd = $_POST['newpwd'];
+ $repwd = $_POST['confirmpwd'];
+
+ if(md5('lylme' . $oldpwd) == $conf['admin_pwd']) {
+ if(empty($newpwd)) {//未修改密码
+ if(empty($user)) {
+ echo '';
+ } else {
+ //只修改用户名
+ saveSetting('admin_user', $user);
+ echo '';
+ }
+ } elseif(!empty($newpwd)) {//修改密码
+ if ($newpwd == $repwd && empty($user)) {
+ $admin_pwd = md5('lylme' . $newpwd);
+ saveSetting('admin_pwd', $admin_pwd);
+ echo '';
+ } elseif($newpwd == $repwd) {
+ $admin_pwd = md5('lylme' . $newpwd);
+ saveSetting('admin_user', $user);
+ saveSetting('admin_pwd', $admin_pwd);
+ echo '';
+ }
+
+ } else {
+ echo '';
}
- else
- {
- saveSetting('admin_user',$user);
- echo '';
- }
-}
- else if(!empty($newpwd))
- {//修改密码
- if ($newpwd==$repwd && empty($user))
- {
- saveSetting('admin_pwd',$newpwd);
- echo '';
- }
- else if($newpwd==$repwd)
- {
- saveSetting('admin_user',$user);
- saveSetting('admin_pwd',$newpwd);
- echo '';
- }
-
- }
-else
-{
- echo '';
-}
-}
+ } else {
+ echo '';
+ }
- else{
- echo '';
- }
-
-}
-
-
-else{
-?>
+} else {
+ ?>
@@ -100,7 +87,7 @@ else{
-
\ No newline at end of file
diff --git a/include/common.php b/include/common.php
index 94c601d..a9501de 100644
--- a/include/common.php
+++ b/include/common.php
@@ -1,35 +1,42 @@
点此安装';
-exit();
+define('SYSTEM_ROOT', dirname(__FILE__) . '/');
+define('ROOT', dirname(SYSTEM_ROOT) . '/');
+//error_reporting(0);
+require ROOT . 'config.php';
+if(!defined('SQLITE') && (!$dbconfig['user'] || !$dbconfig['pwd'] || !$dbconfig['dbname'])) {
+ @unlink(ROOT . 'install/install.lock');
+ header("Location:");
+ exit();
}
-include_once(SYSTEM_ROOT."db.class.php");
-$DB=new DB($dbconfig['host'],$dbconfig['user'],$dbconfig['pwd'],$dbconfig['dbname'],$dbconfig['port']);
-$rs= $DB->query("SELECT * FROM `lylme_config`");
-while($row = $DB->fetch($rs)) $conf[$row['k']]=$row['v'];
-include_once(SYSTEM_ROOT."lists.php");
-include_once(SYSTEM_ROOT."function.php");
-include_once(SYSTEM_ROOT."member.php");
-include_once(SYSTEM_ROOT."tj.php");
-include_once(SYSTEM_ROOT."version.php");
-include_once(SYSTEM_ROOT."updbase.php");
-$linksrows=$DB->num_rows($DB->query("SELECT * FROM `lylme_links`"));
-$groupsrows=$DB->num_rows($DB->query("SELECT * FROM `lylme_groups`"));
+require SYSTEM_ROOT . "db.class.php";
+$DB = new DB($dbconfig['host'], $dbconfig['user'], $dbconfig['pwd'], $dbconfig['dbname'], $dbconfig['port']);
+$web_config = $DB->query("SELECT * FROM `lylme_config`");
+while($row = $DB->fetch($web_config)) {
+ $conf[$row['k']] = $row['v'];
+}
+require SYSTEM_ROOT . "lists.php";
+require SYSTEM_ROOT . "function.php";
+require SYSTEM_ROOT . "member.php";
+require SYSTEM_ROOT . "tj.php";
+require SYSTEM_ROOT . "version.php";
+require SYSTEM_ROOT . "updbase.php";
+require SYSTEM_ROOT . "site.php";
+
$cdnpublic = cdnpublic($conf['cdnpublic']);
-$templatepath ='./template/'.$conf["template"];
-$template = $templatepath.'/index.php';
+$templatepath = './template/' . $conf["template"];
+$template = $templatepath . '/index.php';
$background = $conf["background"];
$wap_background = $conf["wap_background"];
-if(checkmobile()){if(!empty($wap_background)){$background_img = $wap_background;}
-else{$background_img = $background; }}else{$background_img = $background; }
-?>
\ No newline at end of file
+if(checkmobile()) {
+ if(!empty($wap_background)) {
+ $background_img = $wap_background;
+ } else {
+ $background_img = $background;
+ }
+} else {
+ $background_img = $background;
+}
diff --git a/include/go.php b/include/go.php
index 740ba50..e2bb337 100644
--- a/include/go.php
+++ b/include/go.php
@@ -1,53 +1,53 @@
query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '".$pass."';");
- while ($pwd = $DB->fetch($pwds)) {
- array_push($show,$pwd[pwd_id]);
- }
- if(empty($show)){
- //无数据
- exit('');
- }
- else{
- //有数据
- $_SESSION['list'] = $show;
- $_SESSION['pass'] = 1;
+ $pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '" . $pass . "';");
+ while ($pwd = $DB->fetch($pwds)) {
+ array_push($show, $pwd['pwd_id']);
+ }
+ if(empty($show)) {
+ //无数据
+ exit('');
+ } else {
+ //有数据
+ $_SESSION['list'] = $show;
+ $_SESSION['pass'] = 1;
+ }
}
- }
-}
-else {
+} else {
//已登录
- if(!empty($pass)){
+ if(!empty($pass)) {
$show = array();
- $pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '".$pass."';");
- while ($pwd = $DB->fetch($pwds)) {
- array_push($show,$pwd['pwd_id']);
- }
- if(empty($show)){
- $_SESSION['pass'] = 0;
+ $pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '" . $pass . "';");
+ while ($pwd = $DB->fetch($pwds)) {
+ array_push($show, $pwd['pwd_id']);
+ }
+ if(empty($show)) {
+ $_SESSION['pass'] = null;
$_SESSION['list'] = array();
- }
+ }
}
}
-if(basename($_SERVER['PHP_SELF']) != basename(__FILE__)) return;
- header("Location: ../");
-?>
\ No newline at end of file
+if(basename($_SERVER['PHP_SELF']) != basename(__FILE__)) {
+ return;
+}
+header("Location: ../");
diff --git a/include/site.php b/include/site.php
new file mode 100644
index 0000000..cf59465
--- /dev/null
+++ b/include/site.php
@@ -0,0 +1,3 @@
+num_rows($DB->query("SELECT * FROM `lylme_links`")); //链接数量
+$groupsrows = $DB->num_rows($DB->query("SELECT * FROM `lylme_groups`")); //分类数量
+$file = SYSTEM_ROOT . "/log.txt";
+if(!file_exists($file)) {
+ touch($file);
+} else {
+ $fp = fopen($file, 'r+');
+ $content = '';
+ if (flock($fp, LOCK_EX)) {
+ while (($buffer = fgets($fp, 1024)) != false) {
+ $content = $content . $buffer;
+ }
+ $tjdate = unserialize($content);
+ //设置记录键值
+ $tjtotal = 'total';
+ $tjmonth = date('Ym');
+ $tjtoday = date('Ymd');
+ $tjyesterday = date('Ymd', strtotime("-1 day"));
+ $tongji = array();
+ if(strpos($_SERVER['REQUEST_URI'], 'admin') == false) {
+
+ $tongji[$tjtotal] = $tjdate[$tjtotal] + 1;
+ // 本月访问量增加
+ $tongji[$tjmonth] = $tjdate[$tjmonth] + 1;
+ // 今日访问增加
+ $tongji[$tjtoday] = $tjdate[$tjtoday] + 1;
+ //保持昨天访问
+ $tongji[$tjyesterday] = $tjdate[$tjyesterday];
+ ftruncate($fp, 0); // 将文件截断到给定的长度
+ rewind($fp); // 倒回文件指针的位置
+ fwrite($fp, serialize($tongji));
+ } else {
+ $tongji[$tjtotal] = $tjdate[$tjtotal] ;
+ // 本月访问量增加
+ $tongji[$tjmonth] = $tjdate[$tjmonth];
+ // 今日访问增加
+ $tongji[$tjtoday] = $tjdate[$tjtoday];
+ //保持昨天访问
+ $tongji[$tjyesterday] = $tjdate[$tjyesterday];
+ }
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ //输出数据
+ $tjtotal = $tongji[$tjtotal];
+ $tjmonth = $tongji[$tjmonth];
+ $tjtoday = $tongji[$tjtoday];
+ $tjyesterday = $tongji[$tjyesterday] ? $tongji[$tjyesterday] : 0;
+ //访总问 {$tjtotal} 本月 {$tjmonth} 昨日 {$tjyesterday} 今日 {$tjtoday}
+ }
}
-}
-?>
\ No newline at end of file
diff --git a/include/updbase.php b/include/updbase.php
index b0deb7c..ee53cc9 100644
--- a/include/updbase.php
+++ b/include/updbase.php
@@ -1,74 +1,91 @@
query("INSERT INTO `lylme_config` (`k`, `v`, `description`) VALUES ('md5pass', '1', '启用md5加密密码');");
+ saveSetting('admin_pwd', $admin_pwd);
+ }
+
+ }
+ $sql = explode(';', $sql);
+ for ($i = 0;$i < count($sql);$i++) {
+ if (trim($sql[$i]) == '') {
+ continue;
+ }
+ if($DB->query($sql[$i])) {
+ }
+ }
+ saveSetting('version', $version);
}
-if($sqlvn < 10103) {
- $version = 'v1.1.3';
- @unlink(ROOT.'include/head.php');
- @unlink(ROOT.'include/home.php');
- @unlink(ROOT.'include/apply.php');
- @unlink(ROOT.'include/footer.php');
- $sql = $sql.file_get_contents(ROOT.'install/update1.sql');
-}
-if($sqlvn < 10104) {
- $version = 'v1.1.4';
-}
-if($sqlvn < 10105) {
- $version = 'v1.1.5';
- $sql = $sql.file_get_contents(ROOT.'install/update2.sql');
-}
-if($sqlvn < 10106) {
- $version = 'v1.1.6';
- $sql = $sql.file_get_contents(ROOT.'install/update3.sql');
-}
-if($sqlvn < 10109) {
- $version = 'v1.1.9';
- $sql = $sql.file_get_contents(ROOT.'install/update4.sql');
-}
-if($sqlvn < 10200) {
- $version = 'v1.2.0';
- $sql = $sql.file_get_contents(ROOT.'install/update5.sql');
-}
-if($sqlvn < 10205) {
- $version = 'v1.2.5';
-}
-if($sqlvn < 10300) {
- $version = 'v1.3.0';
-}
-if($sqlvn < 10304) {
- $version = 'v1.3.4';
-}
-if($sqlvn < 10500) {
- $version = 'v1.5.0';
-}
-if($sqlvn < 10501) {
- $version = 'v1.5.1';
- $sql = $sql.file_get_contents(ROOT.'install/update6.sql');
-}
-if($sqlvn < 10600) {
- $version = 'v1.6.0';
- $sql = $sql.file_get_contents(ROOT.'install/update7.sql');
-}
-if($sqlvn < 10700) {
- $version = 'v1.7.0';
-}
-$sql=explode(';',$sql);
-for ($i=0;$i
query($sql[$i])) {
- }
-}
-saveSetting('version',$version);
-}
\ No newline at end of file
diff --git a/include/version.php b/include/version.php
index 0fbc3da..14448fc 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1,3 +1,3 @@
\ No newline at end of file
+
+define('VERSION', '1.8.0');
diff --git a/index.php b/index.php
index d6c9f79..c5ad2ba 100644
--- a/index.php
+++ b/index.php
@@ -1,9 +1,11 @@
安装程序您还未安装,点击这里开始安装!');
-include "./include/common.php";
+if (!file_exists('install/install.lock')) {
+ header("Location:/install");
+ exit();
+}
+require "./include/common.php";
session_start(); //设置session
-$_SESSION['list'] = isset($_SESSION['list'])?$_SESSION['list']:array();
-include $template;
-?>
\ No newline at end of file
+$_SESSION['list'] = isset($_SESSION['list']) ? $_SESSION['list'] : array();
+require $template;
diff --git a/pwd/index.php b/pwd/index.php
index 87c431a..06466af 100644
--- a/pwd/index.php
+++ b/pwd/index.php
@@ -34,21 +34,23 @@ and (max-width:320px){.form-wrapper{padding-top:10%;border-radius:2px;margin:50p
';}
+if(!empty($background = background())) {
+ $background = str_replace('./', '../', $background);
+ echo '