From 32bd40a5818cf68e87b6173ed28f23ec31acb080 Mon Sep 17 00:00:00 2001 From: Cinnamoroll-Rabbit <101342651+Cinnamoroll-Rabbit@users.noreply.github.com> Date: Fri, 15 Apr 2022 20:57:27 +0800 Subject: [PATCH] Add files via upload --- README-zh.md | 55 ++++++++++ README.md | 55 ++++++++++ link.php | 54 ++++++++++ nginx.htaccess | 8 ++ statics.php | 272 +++++++++++++++++++++++++++++++++++++++++++++++++ stats.php | 147 ++++++++++++++++++++++++++ tos.php | 84 +++++++++++++++ 7 files changed, 675 insertions(+) create mode 100644 README-zh.md create mode 100644 README.md create mode 100644 link.php create mode 100644 nginx.htaccess create mode 100644 statics.php create mode 100644 stats.php create mode 100644 tos.php diff --git a/README-zh.md b/README-zh.md new file mode 100644 index 0000000..b489e11 --- /dev/null +++ b/README-zh.md @@ -0,0 +1,55 @@ +- **简体中文** +- [English](./README.md) + +

+ +

+GitHub Workflow Status +GitHub release (latest SemVer including pre-releases) +GitHub +

+ +优雅的开源短URL生成API,现在,回应您的等待。 + +Cinnamoroll ShortUrl是一个用PHP和HTML编写的开源项目,这意味着您可以在自己的web服务器上自由的部署它! + +它可以让你使用你自己的域名部署短链接。 + +## 特征 + +- 一个功能齐全的短链接API服务 +- 无需登录,免费使用 +- 在线与朋友分享API! +- 易于使用 + +## 要求 + +- 靠谱并启用伪静态的Web服务器 (Nginx,Apache or IIS) +- PHP >= 7.0.0 +- MySQL >= 5.5.0 + +## 快速安装 + +看Wiki + +## 支持 + +如果这个软件对你有用,欢迎给一个Star。 + +## Demo + +演示站 + +### 赞助商 + +Coming soon + +### 支持者 + +Coming soon + +## Copyright & License + +Apache License V2.0 + +Copyright (c) 2016-present Cinnamoroll-Home diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0f2e14 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +- **English** +- [简体中文](./README-zh.md) + +

+ +

+GitHub Workflow Status +GitHub release (latest SemVer including pre-releases) +GitHub +

+ +Elegant open source short URL production API, now, respond to your waiting. + +Cinnamoroll ShortUrl is an open-source project written in PHP and HTML, which means you can deploy it freely on your own web server! + +Deploy short URLs using your own domain name. + +## Features + +- A fully functional short link API service +- No login, free use +- Share API with your friends online! +- Easy-to-use + +## Requirements + +- A web server with URL rewriting enabled (Nginx,Apache or IIS) +- PHP >= 7.0.0 +- MySQL >= 5.5.0 + +## Quick Install + +See Wiki + +## Supporting + +Is this software is useful to you, welcome to star. + +## Demo Site + +Demo Site + +### Sponsors + +Coming soon + +### Backers + +Coming soon + +## Copyright & License + +Apache License V2.0 + +Copyright (c) 2016-present Cinnamoroll-Home diff --git a/link.php b/link.php new file mode 100644 index 0000000..3a6e196 --- /dev/null +++ b/link.php @@ -0,0 +1,54 @@ +query("SELECT * FROM settings"); +$info = $db->fetch_array($data); +$ads = $db->query("SELECT * FROM ads"); +$ads_info = $db->fetch_array($ads); + + +$shr = $db->escape_value($_GET['id']); + + +$getLink = $db->query("SELECT URL, date, hits, id, pass FROM links WHERE BINARY link = '$shr'"); +$getLink = $db->fetch_array($getLink); +$url = $getLink["URL"]; +$date = $getLink["date"]; +$hits = $getLink["hits"]; +$id = $getLink["id"]; +$pass = $getLink["pass"]; + +if ($url == !'') { + + + $upd = "UPDATE links SET hits = hits+1 WHERE id = '$id'"; + $retval = $db->query($upd); + $upd01 = "UPDATE links SET last_visit = NOW() WHERE id = '$id'"; + $retval01 = $db->query($upd01); + + + if ($pass != '') { //link has password + if ($_POST['txtpass'] != $pass) { + include "functions/password.php"; + } else { + include "functions/redirect.php"; + } + } else { + include "functions/redirect.php"; + } +} else { // link not found + $error_msg = "找不到您跳转的链接"; + include "functions/error.php"; //error page +} +$db->close_connection(); + + +?> diff --git a/nginx.htaccess b/nginx.htaccess new file mode 100644 index 0000000..dfe31e1 --- /dev/null +++ b/nginx.htaccess @@ -0,0 +1,8 @@ +rewrite ^/about /about.php last; +rewrite ^/api-about /api-about.php last; +rewrite ^/contact /contact.php last; +rewrite ^/tos /tos.php last; +rewrite ^/([^/.]+)/?$ /link.php?id=$1 last; +rewrite ^/404 /404.php last; +error_page 404 http://×Ô¼ºµÄÓòÃû/404; +error_page 403 http://×Ô¼ºµÄÓòÃû/404; diff --git a/statics.php b/statics.php new file mode 100644 index 0000000..d9f7dc4 --- /dev/null +++ b/statics.php @@ -0,0 +1,272 @@ +query("SELECT * FROM settings"); +$info = $db->fetch_array($data); + +$ads = $db->query("SELECT * FROM ads"); +$ads_info = $db->fetch_array($ads); +?> + + + + + + + + + + + 统计 + + + + + + + + + + + + + + + + + +
+ +
+
+
+ +
+
+
+
+ + + query("SELECT * FROM links WHERE pass = '' ORDER BY date DESC LIMIT 10 "); + ?> + + + + + + + + + + fetch_array($result)) { + $count01 = mb_strlen( $row['URL']); + if($count01 > 50){ + $myurl = substr($row['URL'],0,50)."..."; + } else { + $myurl = $row['URL']; + } + ?> + + + + + + + + + + +
目标网址转向链接创建日期状态统计
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ 统计 +
+
+
+
+
+
+
+
+
+ + + query("SELECT * FROM links WHERE pass = '' ORDER BY hits DESC LIMIT 10 "); + ?> + + + + + + + + + + fetch_array($result)) { + $count01 = mb_strlen( $row['URL']); + if($count01 > 50){ + $myurl = substr($row['URL'],0,50)."..."; + } else { + $myurl = $row['URL']; + } + ?> + + + + + + + + + + +
目标网址转向链接创建日期状态统计
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ 统计 +
+
+
+
+
+
+
+
+
+ + + query("SELECT * FROM links WHERE pass = '' ORDER BY last_visit DESC LIMIT 10 "); + ?> + + + + + + + + + + fetch_array($result)) { + $count01 = mb_strlen( $row['URL']); + if($count01 > 50){ + $myurl = substr($row['URL'],0,50)."..."; + } else { + $myurl = $row['URL']; + } + + ?> + + + + + + + + + + +
目标网址转向链接创建日期状态统计
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ 统计 +
+
+
+
+
+
+
+
+ + +
+ + + + + + + + diff --git a/stats.php b/stats.php new file mode 100644 index 0000000..118ea57 --- /dev/null +++ b/stats.php @@ -0,0 +1,147 @@ +query("SELECT * FROM settings"); +$info = $db->fetch_array($data); + +$shr = $db->escape_value($_GET['id']); + +$sql = $db->query("SELECT URL, date, hits, id, pass, last_visit FROM links WHERE BINARY link = '$shr'"); +$sql = $db->fetch_array($sql); +$url = $sql["URL"]; +$date = $sql["date"]; +$hits = $sql["hits"]; +$id = $sql["id"]; +$pass = $sql["pass"]; +$last_visit = $sql["last_visit"]; + +if ($url == '') { + $error_msg = "找不到您跳转的链接"; + include "functions/error.php"; //error page + $db->close_connection(); + exit; +} else { + $myweb = $info['URL']; + $created_link = $myweb . '/' . $shr; + ?> + + + + + + + + + + + + URL统计 + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + + +
+
+
+
+

短链统计二维码

+
API接口错误请联系管理员!
+
+
+ + + + + +
+
+
+
+
+

总点击量

+

+
+

最后访问

+

+
+

创建日期

+

+
+
+
+
+ + + + + + + + + + + + + + + + + close_connection(); +?> diff --git a/tos.php b/tos.php new file mode 100644 index 0000000..89fe62b --- /dev/null +++ b/tos.php @@ -0,0 +1,84 @@ +query("SELECT * FROM settings"); +$info = $db->fetch_array($data); +?> + + + + + + + + + + + 使用许可 - <?php echo $info['name']; ?> + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+ + +
+ + + + + + + +close_connection(); ?>