Browse Source

[update] home page

Steven Yan 3 years ago
parent
commit
c7bf70b038
5 changed files with 69 additions and 76 deletions
  1. 12 12
      api/kp.php
  2. 11 10
      api/kp_info.php
  3. 27 25
      click.js
  4. 14 25
      clock.js
  5. 5 4
      index.html

+ 12 - 12
api/kp.php

@@ -1,19 +1,20 @@
 <?php
 ini_set('display_errors', true);
-ini_set("include_path", '/home/stevenos/php:' . ini_get("include_path") );
+ini_set("include_path", '/home/stevenos/php:' . ini_get("include_path"));
 error_reporting(E_ALL);
 date_default_timezone_set('Asia/Shanghai');
 global $user_online;
 
-function load_data() {
+function load_data()
+{
     global $user_online;
     $data = file_get_contents($user_online);
     $data = json_decode($data, true);
     $json = array();
     if (sizeof($data) > 0) {
         foreach ((array) $data as $single_data) {
-            if (date('mdHis') - date('mdHis',strtotime(date('Y-').$single_data["time"])) < 60) {
-                if (strpos(json_encode($json),$single_data['ip'])) {
+            if (date('mdHis') - date('mdHis', strtotime(date('Y-') . $single_data["time"])) < 60) {
+                if (strpos(json_encode($json), $single_data['ip'])) {
                     continue;
                 }
                 $json[] = array(
@@ -28,10 +29,11 @@ function load_data() {
     return $data;
 }
 
-function save_data($data) {
+function save_data($data)
+{
     global $user_online;
     $old_data = load_data();
-    if (!strpos(json_encode($old_data),$data['ip'])) {
+    if (!strpos(json_encode($old_data), $data['ip'])) {
         array_push($old_data, $data);
         $old_data = array_unique($old_data, SORT_REGULAR);
     }
@@ -39,14 +41,14 @@ function save_data($data) {
 }
 
 
-preg_match('/(\d+)\-.*/',$_GET['g'],$matches);
+preg_match('/(\d+)\-.*/', $_GET['g'], $matches);
 $user_online = $matches[1];
-$user_online = $user_online.".txt";
+$user_online = $user_online . ".txt";
 if ($user_online == '.txt') {
     exit();
 }
 
-$action = isset($_GET['action'])?$_GET['action']:'s';
+$action = isset($_GET['action']) ? $_GET['action'] : 's';
 if ($action == "s") {
     $json = array(
         "ip" => getenv('REMOTE_ADDR'),
@@ -56,7 +58,7 @@ if ($action == "s") {
     if (file_exists($user_online)) {
         save_data($json);
     } else {
-        file_put_contents($user_online,'[]');
+        file_put_contents($user_online, '[]');
         save_data($json);
     }
     header('Content-Type: image/png');
@@ -71,5 +73,3 @@ if ($action == "s") {
 } else {
     exit("error!");
 }
-
-?>

+ 11 - 10
api/kp_info.php

@@ -4,12 +4,13 @@ date_default_timezone_set('Asia/Shanghai');
 ini_set('user_agent', 'Spirit');
 
 require_once 'vendor/autoload.php';
+
 use UAParser\Parser;
 
 $user_online = $_GET['g'];
-$or = file_get_contents("https://stevenapis.xyz/api/kp.php?action=p&g=".$user_online ."-dsssss");
-$data = json_decode($or,true);
-file_put_contents("kp/" .date('mdHis')."-".$user_online.".txt", json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
+$or = file_get_contents("https://stevenapis.xyz/api/kp.php?action=p&g=" . $user_online . "-dsssss");
+$data = json_decode($or, true);
+file_put_contents("kp/" . date('mdHis') . "-" . $user_online . ".txt", json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
 $json = array();
 foreach ((array)$data as $user) {
     $ip = $user["ip"];
@@ -17,13 +18,13 @@ foreach ((array)$data as $user) {
     $time = $user["time"];
     $parser = Parser::create();
     $result = $parser->parse($ua);
-    $ua = $result->device->brand ." ".$result->device->model . "/" . $result->os->toString();;
+    $ua = $result->device->brand . " " . $result->device->model . "/" . $result->os->toString();;
     // $ua = $result->originalUserAgent;
-    $file_contents = file_get_contents('http://ip.taobao.com/outGetIpInfo?accessKey=alibaba-inc&ip='.$ip);
-    $result = json_decode($file_contents,true)["data"];
-    $ip = preg_replace('~(.*?):(.*?):.*~',"$1:$2:**:****",$ip);
-    $ip = preg_replace('~(\d+)\.(\d+)\.(\d+)\.(\d+)~',"$1.$2.*.*",$ip);
-    $addr = $result["country"] != "中国" ? $result["country"]:$result["region"]. ' ' .  $result["city"] . ' ' . $result["isp"];
+    $file_contents = file_get_contents('http://ip.taobao.com/outGetIpInfo?accessKey=alibaba-inc&ip=' . $ip);
+    $result = json_decode($file_contents, true)["data"];
+    $ip = preg_replace('~(.*?):(.*?):.*~', "$1:$2:**:****", $ip);
+    $ip = preg_replace('~(\d+)\.(\d+)\.(\d+)\.(\d+)~', "$1.$2.*.*", $ip);
+    $addr = $result["country"] != "中国" ? $result["country"] : $result["region"] . ' ' .  $result["city"] . ' ' . $result["isp"];
     $json[] = array(
         "ip" => $ip,
         "addr" => $addr,
@@ -31,4 +32,4 @@ foreach ((array)$data as $user) {
         "time" => $time
     );
 }
-echo json_encode($json, JSON_PRETTY_PRINT);
+echo json_encode($json, JSON_PRETTY_PRINT);

+ 27 - 25
click.js

@@ -1,30 +1,32 @@
 // var a_idx = 0;
-// jQuery(document).ready(function($) {
-//     $("body").click(function(e) {
-//         // var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
-//         var $i = $("<span/>").text(a[a_idx]);
-//         a_idx = (a_idx + 1) % a.length;
-//         var x = e.pageX,
-//             y = e.pageY;
-//         $i.css({
-//             "z-index": 999999999999999999999999999999999999999999999999999999999999,
-//             "top": y - 20,
-//             "left": x,
-//             "position": "absolute",
-//             "color": "#ff0000",
-//             "font-size": "20px",
-//             "text-shadow": "0px 0px 5px #555"
-//         });
-//         $("body").append($i);
-//         $i.animate({
-//                 "top": y - 300,
-//                 "opacity": 0
-//             },
-//             1500,
-//             function() {
-//                 $i.remove();
-//             });
+// jQuery(document).ready(function ($) {
+//   $("body").click(function (e) {
+//     // var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
+//     var $i = $("<span/>").text(a[a_idx]);
+//     a_idx = (a_idx + 1) % a.length;
+//     var x = e.pageX,
+//       y = e.pageY;
+//     $i.css({
+//       "z-index": 999999999999999999999999999999999999999999999999999999999999,
+//       top: y - 20,
+//       left: x,
+//       position: "absolute",
+//       color: "#ff0000",
+//       "font-size": "20px",
+//       "text-shadow": "0px 0px 5px #555",
 //     });
+//     $("body").append($i);
+//     $i.animate(
+//       {
+//         top: y - 300,
+//         opacity: 0,
+//       },
+//       1500,
+//       function () {
+//         $i.remove();
+//       }
+//     );
+//   });
 // });
 
 $("html,body").click(function (e) {

+ 14 - 25
clock.js

@@ -7,33 +7,22 @@ function startTimer() {
 }
 
 function nowTime() {
-  Date.prototype.Format = function (fmt) {
-    var o = {
-      "M+": this.getMonth() + 1, //月份
-      "d+": this.getDate(), //日
-      "h+": this.getHours(), //小时
-      "m+": this.getMinutes(), //分
-      "s+": this.getSeconds(), //秒
-      "q+": Math.floor((this.getMonth() + 3) / 3), //季度
-      S: this.getMilliseconds(), //毫秒
-    };
-    if (/(y+)/.test(fmt))
-      fmt = fmt.replace(
-        RegExp.$1,
-        (this.getFullYear() + "").substr(4 - RegExp.$1.length)
-      );
-    for (var k in o)
-      if (new RegExp("(" + k + ")").test(fmt))
-        fmt = fmt.replace(
-          RegExp.$1,
-          RegExp.$1.length == 1
-            ? o[k]
-            : ("00" + o[k]).substr(("" + o[k]).length)
-        );
-    return fmt;
+  var formatTime = (inputTime) => {
+    var date = new Date(Number.parseInt(inputTime));
+    var year = date.getFullYear();
+    var month = date.getMonth() + 1;
+    var day = date.getDate();
+    var hour = date.getHours();
+    var minute = date.getMinutes();
+    var second = date.getSeconds();
+    return (
+      [year, month, day].map(formatNumber).join("-") +
+      " " +
+      [hour, minute, second].map(formatNumber).join(":")
+    );
   };
   // var nowdate = new Date().Format("yyyyMM");
-  var nowtime = new Date().Format("yyyy-MM-dd  hh:mm:ss");
+  var nowtime = formatTime(new Date());
   document.getElementById("nowTime").innerHTML = "" + nowtime;
   setTimeout(nowTime, 800);
 }

+ 5 - 4
index.html

@@ -50,7 +50,8 @@
     white-space: normal;
     word-wrap: break-word;
     text-decoration: none;
-    color: #232323
+    color: #232323;
+    cursor: url("https://ryzenx.oss-accelerate.aliyuncs.com/cur/Redstonelink.cur"), auto;
   }
 
   #search_input_bd {
@@ -417,7 +418,7 @@
       </div>
 
       <div class="box">
-        <a href="https://m.youtube.com"></a>
+        <a href="https://www.youtube.com"></a>
         <p><img class="icon" src="https://ryzenx.oss-accelerate.aliyuncs.com/img/youtube.png"></p>
         <p class="url">Youtube</p>
       </div>
@@ -430,13 +431,13 @@
 
 
       <div class="box">
-        <a href="https://translate.google.cn"></a>
+        <a href="https://translate.google.com"></a>
         <p><img class="icon" src="https://ryzenx.oss-accelerate.aliyuncs.com/img/Translate.png"></p>
         <p class="url">翻译</p>
       </div>
 
       <div class="box">
-        <a href="https://www.gmail.com"></a>
+        <a href="https://mail.google.com"></a>
         <p><img class="icon" src="https://ryzenx.oss-accelerate.aliyuncs.com/img/Gmail.png"></p>
         <p class="url">Gmail</p>
       </div>