From 91491d2e8ddd509e54e6bcc7b4bdd67a21649cb0 Mon Sep 17 00:00:00 2001 From: Shuqi Date: Tue, 14 Nov 2023 02:57:29 +0800 Subject: [PATCH] Logging --- download.php | 22 ++++++++++++++++++++++ public/icons/cat.svg | 14 ++++++++++++++ public/icons/pencil.svg | 8 ++++++++ src/icons.json | 2 ++ 4 files changed, 46 insertions(+) create mode 100644 public/icons/cat.svg create mode 100644 public/icons/pencil.svg diff --git a/download.php b/download.php index cd913d2..2f3f061 100644 --- a/download.php +++ b/download.php @@ -5,7 +5,27 @@ if (empty($_GET['icon']) || !preg_match("/^\w+(\.svg)?$/", $_GET['icon'])) exit; $request = $_GET['icon']; $icons_path = __DIR__."/icons"; +function get_ip() { + //whether ip is from the share internet + if(!empty($_SERVER['HTTP_CLIENT_IP'])) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + } + //whether ip is from the proxy + elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + } + //whether ip is from the remote address + else{ + $ip = $_SERVER['REMOTE_ADDR']; + } + return $ip; +} +$time = date("Y-m-d H:i:s"); +$ip = get_ip(); + if ($request == 'all') { + file_put_contents('download_log', "$time - $ip - download all".PHP_EOL , FILE_APPEND | LOCK_EX); + $mtime = filemtime(__DIR__.'/assets/index.js'); $zip_filename = "pixel-icons-$mtime.zip"; $zip_path = __DIR__."/zipped/$zip_filename"; @@ -46,6 +66,8 @@ if ($request == 'all') { } } else { + file_put_contents('download_log', "$time - $ip - $request".PHP_EOL , FILE_APPEND | LOCK_EX); + $file = $icons_path . "/$request"; if (!is_file($file)) exit; diff --git a/public/icons/cat.svg b/public/icons/cat.svg new file mode 100644 index 0000000..ef5bdcb --- /dev/null +++ b/public/icons/cat.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/icons/pencil.svg b/public/icons/pencil.svg new file mode 100644 index 0000000..fe8f2b4 --- /dev/null +++ b/public/icons/pencil.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/icons.json b/src/icons.json index a60d7ab..aa89b7a 100644 --- a/src/icons.json +++ b/src/icons.json @@ -35,6 +35,7 @@ "caret-right.svg": [ "caret-right", "ui-icon", "blue" ], "caret-up.svg": [ "caret-up", "ui-icon", "blue" ], "cart.svg": [ "cart", "ui-icon", "yellow" ], + "cat.svg": [ "cat", "full-body", "animal", "orange", "white" ], "cat-black.svg": [ "cat-black", "animal", "black" ], "cat-calico.svg": [ "cat-calico", "animal", "orange", "white" ], "cat-grey.svg": [ "cat-grey", "animal", "grey-gray" ], @@ -76,6 +77,7 @@ "paper-bag.svg": [ "paper-bag", "ui-icon", "pink" ], "paste.svg": [ "paste", "ui-icon", "cut", "copy" ], "pear.svg": [ "pear", "fruit", "food", "green" ], + "pencil.svg": [ "pencil", "ui-icon", "yellow", "blue", "edit" ], "phone.svg": [ "phone", "ui-icon", "red" ], "photo.svg": [ "photo", "ui-icon", "blue" ], "picture.svg": [ "picture", "ui-icon", "blue" ],