Add files via upload
This commit is contained in:
parent
b8a7082c29
commit
7a9c2fa314
14
.htaccess
Normal file
14
.htaccess
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Options -Indexes
|
||||||
|
order deny,allow
|
||||||
|
|
||||||
|
<Files ~ "^.(htaccess|htpasswd)$">
|
||||||
|
deny from all
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
<Files ~ "^database.db">
|
||||||
|
deny from all
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond $1 !^(api|asset)
|
||||||
|
RewriteRule ^(\d+|\w+)$ index.php?id=$1
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 任宝硕
|
Copyright (c) 2017 Caringor
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
21
README.md
21
README.md
@ -1,2 +1,19 @@
|
|||||||
# Shortlink
|
# ShortLink
|
||||||
短链接生成网站源码
|
|
||||||
|
代码基于 [CRZ.im](https://github.com/Caringor/CRZ.im) 开发,感谢原作者的辛勤劳动。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> 一个支持域名缩短网站的源代码
|
||||||
|
|
||||||
|
## 概述
|
||||||
|
|
||||||
|
这是一个网址缩短服务的网站的源代码。
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
本项目基于 `PHP` 、 `SQLite` 进行开发,您只需要修改 `config.php` 的相关配置并把 inc 目录权限设置为可读写即可。对于 `Nginx` 用户,则还需把 `nginx.txt` 里面的内容添加到 `Nginx` 的配置文件里。
|
||||||
|
|
||||||
|
## 本项目相比原项目有了什么变化?
|
||||||
|
|
||||||
|
本项目增加了
|
||||||
|
15
config.php
Normal file
15
config.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
$config = [];
|
||||||
|
|
||||||
|
// 程序安装路径
|
||||||
|
$config['path'] = '/';
|
||||||
|
// ID 长度
|
||||||
|
$config['length'] = 8;
|
||||||
|
// 网站标题
|
||||||
|
$config['title'] = '短链生成';
|
||||||
|
// 网站简介
|
||||||
|
$config['description'] = '在线网址缩短服务';
|
||||||
|
|
||||||
|
?>
|
68
index.php
Normal file
68
index.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
// 引入类
|
||||||
|
require_once('inc/require.php');
|
||||||
|
|
||||||
|
// 重定向
|
||||||
|
if(isset($_GET['id'])) {
|
||||||
|
$url_c = new url();
|
||||||
|
// 获取目标网址
|
||||||
|
$url = $url_c->get_url($_GET['id']);
|
||||||
|
// 重定向至目标网址
|
||||||
|
if($url) {
|
||||||
|
header('Location: ' . $url);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<!--标题-->
|
||||||
|
<title><?php echo get_title() . ' - ' . get_description(); ?></title>
|
||||||
|
<!--介绍、关键词的放置处(SEO优化)-->
|
||||||
|
<meta name="description" content="ShortLink 短链接服务">
|
||||||
|
<meta name="keyword" content="短链接,ShortLink,Link,链接缩短,短网址">
|
||||||
|
<!--引入 CSS 文件-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="asset/css/main.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrap">
|
||||||
|
<!--网页显示标题-->
|
||||||
|
<div class="meta">
|
||||||
|
<h2 class="title"><?php echo get_title(); ?></h2>
|
||||||
|
<h3 class="description"><?php echo get_description(); ?></h3>
|
||||||
|
</div>
|
||||||
|
<br><br>
|
||||||
|
<!--链接显示区-->
|
||||||
|
<div class="link-area">
|
||||||
|
<input id="url" type="text" placeholder="源网址" />
|
||||||
|
<input id="submit" type="button" value="生成" onclick="APP.fn.setUrl(this)" />
|
||||||
|
<br><br>
|
||||||
|
<input id="shorturl" type="text" placeholder="短网址" readonly/>
|
||||||
|
<input id="shorturlcopy" type="button" value="复制" onclick="copyText()" />
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
Copyright © <a href="https://www.baoshuo.ren/">宝硕小站</a> | <a href="https://github.com/Caringor/CRZ.im/" title="源码" target="_blank">Github</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--嵌入 JS 代码-->
|
||||||
|
<script>
|
||||||
|
document.body.oncopy = function() {
|
||||||
|
Swal.fire({
|
||||||
|
allowOutsideClick:false,
|
||||||
|
type:'success',
|
||||||
|
title: '复制成功!',
|
||||||
|
showConfirmButton: false,
|
||||||
|
timer: 3000
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<!--引入 JS 文件-->
|
||||||
|
<script type="text/javascript" src="asset/js/app.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user