index.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. // 引入类
  3. require_once('inc/require.php');
  4. // 重定向
  5. if(isset($_GET['id'])) {
  6. $url_c = new url();
  7. // 获取目标网址
  8. $url = $url_c->get_url($_GET['id']);
  9. // 重定向至目标网址
  10. if($url) {
  11. header('Location: ' . $url);
  12. exit;
  13. }
  14. }
  15. ?>
  16. <!DOCTYPE HTML>
  17. <html>
  18. <head>
  19. <meta charset="utf-8">
  20. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  21. <!--标题-->
  22. <title><?php echo get_title() . ' - ' . get_description(); ?></title>
  23. <!--介绍、关键词的放置处(SEO优化)-->
  24. <meta name="description" content="ShortLink 短链接服务">
  25. <meta name="keyword" content="短链接,ShortLink,Link,链接缩短,短网址">
  26. <!--引入 CSS 文件-->
  27. <link type="text/css" rel="stylesheet" href="asset/css/main.css">
  28. </head>
  29. <body>
  30. <div class="wrap">
  31. <!--网页显示标题-->
  32. <div class="meta">
  33. <h2 class="title"><?php echo get_title(); ?></h2>
  34. <h3 class="description"><?php echo get_description(); ?></h3>
  35. </div>
  36. <br><br>
  37. <!--链接显示区-->
  38. <div class="link-area">
  39. <input id="url" type="text" placeholder="源网址" />
  40. <input id="submit" type="button" value="生成" onclick="APP.fn.setUrl(this)" />
  41. <br><br>
  42. <input id="shorturl" type="text" placeholder="短网址" readonly/>
  43. <input id="shorturlcopy" type="button" value="复制" onclick="copyText()" />
  44. </div>
  45. <div class="footer">
  46. Program by <a href="https://baoshuo.ren/?utm_campaign=shortlink-opensouce">Baoshuo</a>, source code is available on <a href="https://github.com/renbaoshuo/Shortlink" title="源码" target="_blank">GitHub</a>.
  47. </div>
  48. </div>
  49. <!--嵌入 JS 代码-->
  50. <script>
  51. shorturl.oncopy = function() {
  52. Swal.fire({
  53. allowOutsideClick:false,
  54. type:'success',
  55. title: '复制成功!',
  56. showConfirmButton: false,
  57. timer: 3000
  58. });
  59. };
  60. </script>
  61. <!--引入 JS 文件-->
  62. <script type="text/javascript" src="asset/js/app.js"></script>
  63. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
  64. </body>
  65. </html>