Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MoeCinnamo authored Apr 15, 2022
1 parent 6d332a1 commit 32bd40a
Show file tree
Hide file tree
Showing 7 changed files with 675 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
- **简体中文**
- [English](./README.md)

<p align="center"><img src="https://s1.ax1x.com/2022/03/13/bqYRTe.jpg"></p>

<p align="center">
<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/actions/"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/Cinnamoroll-Home/Cinnamoroll-ShortUrl/CI?style=flat-square"></a>
<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/releases"><img alt="GitHub release (latest SemVer including pre-releases)" src="https://img.shields.io/github/v/release/Cinnamoroll-Home/Cinnamoroll-ShortUrl?include_prereleases&style=flat-square"></a>
<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/blob/master/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/Cinnamoroll-Home/Cinnamoroll-ShortUrl?style=flat-square"></a>
</p>

优雅的开源短URL生成API,现在,回应您的等待。

Cinnamoroll ShortUrl是一个用PHP和HTML编写的开源项目,这意味着您可以在自己的web服务器上自由的部署它!

它可以让你使用你自己的域名部署短链接。

## 特征

- 一个功能齐全的短链接API服务
- 无需登录,免费使用
- 在线与朋友分享API!
- 易于使用

## 要求

- 靠谱并启用伪静态的Web服务器 (Nginx,Apache or IIS)
- PHP >= 7.0.0
- MySQL >= 5.5.0

## 快速安装

看<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/wiki">Wiki</a>

## 支持

如果这个软件对你有用,欢迎给一个Star。

## Demo

<a href="https://sn-m.xyz">演示站</a>

### 赞助商

Coming soon

### 支持者

Coming soon

## Copyright & License

Apache License V2.0

Copyright (c) 2016-present Cinnamoroll-Home
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
- **English**
- [简体中文](./README-zh.md)

<p align="center"><img src="https://s1.ax1x.com/2022/03/13/bqYRTe.jpg"></p>

<p align="center">
<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/actions/"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/Cinnamoroll-Home/Cinnamoroll-ShortUrl/CI?style=flat-square"></a>
<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/releases"><img alt="GitHub release (latest SemVer including pre-releases)" src="https://img.shields.io/github/v/release/Cinnamoroll-Home/Cinnamoroll-ShortUrl?include_prereleases&style=flat-square"></a>
<a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/blob/master/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/Cinnamoroll-Home/Cinnamoroll-ShortUrl?style=flat-square"></a>
</p>

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 <a href="https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/wiki">Wiki</a>

## Supporting

Is this software is useful to you, welcome to star.

## Demo Site

<a href="https://sn-m.xyz">Demo Site</a>

### Sponsors

Coming soon

### Backers

Coming soon

## Copyright & License

Apache License V2.0

Copyright (c) 2016-present Cinnamoroll-Home
54 changes: 54 additions & 0 deletions link.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/*
=========================================================
* 玉桂短网址源 - 使用你自己的域名搭建更好的短网址服务 - v0.1.0
=========================================================
* Product Page: https://github.com/Cinnamoroll-Home/Cinnamoroll-ShortUrl/
* Copyright 2022 Cinnamoroll (https://mojy.xyz)
* Coded by Cinnamoroll
*/
include "functions/database.php";

$data = $db->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();


?>
8 changes: 8 additions & 0 deletions nginx.htaccess
Original file line number Diff line number Diff line change
@@ -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;
Loading

0 comments on commit 32bd40a

Please sign in to comment.