增加百度搜索UA判断

This commit is contained in:
LyLme 2022-01-21 18:04:06 +08:00
parent 39d3de4a59
commit b64b6a611e
1 changed files with 219 additions and 244 deletions

463
index.php
View File

@ -1,245 +1,220 @@
<?php <?php
@header('Content-Type: text/html; charset=UTF-8'); @header('Content-Type: text/html; charset=UTF-8');
if(!file_exists('install/install.lock')){ if(!file_exists('install/install.lock')){
exit('<title>六零导航页 - 安装</title>您还未安装,点击<a href="install"><font color="blue">这里</font></a>开始安装!'); exit('<title>六零导航页 - 安装</title>您还未安装,点击<a href="install"><font color="blue">这里</font></a>开始安装!');
} }
include "include/head.php"; ?> include "include/head.php";
echo '<body onload="FocusOnInput()"><div class="banner-video">';
<body onload="FocusOnInput()"> if(file_exists('./assets/img/background.jpg')){
echo '<img src="./assets/img/background.jpg" alt="本地背景">';
<div class="banner-video"> }
else{
<?php echo '<img src="./assets/img/bing.php" alt="自定义背景">';
}
if(file_exists('./assets/img/background.jpg')){ ?>
echo '<img src="./assets/img/background.jpg" alt="本地背景">'; <div class="bottom-cover" style="background-image: linear-gradient(rgba(255, 255, 255, 0) 0%, rgb(244 248 251 / 0.6) 50%, rgb(244 248 251) 100%);">
} </div>
else { </div>
echo '<img src="./assets/img/bing.php" alt="Bing每日背景">'; <!--topbar开始-->
} <nav class="navbar navbar-expand-lg navbar-light fixed-top" style="position: absolute; z-index: 10000;">
?> <!--<a class="navbar-brand" href="/"><img src="./assets/img/logos.png" height="25" title="六零起始页"></a>-->
<div class="bottom-cover"> <button class="navbar-toggler collapsed" style="border: none; outline: none;"
</div> type="button" data-toggle="collapse" data-target="#navbarsExample05" aria-controls="navbarsExample05"
</div> aria-expanded="false" aria-label="Toggle navigation">
<!--topbar开始--> <svg t="1636792421852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3801" width="200" height="200"><path d="M901.632 896H122.368c-30.72 0-55.808-25.088-55.808-55.808v-1.536c0-30.72 25.088-55.808 55.808-55.808h779.776c30.72 0 55.808 25.088 55.808 55.808v1.536c-0.512 30.72-25.6 55.808-56.32 55.808zM901.632 568.32H122.368c-30.72 0-55.808-25.088-55.808-55.808v-1.536c0-30.72 25.088-55.808 55.808-55.808h779.776c30.72 0 55.808 25.088 55.808 55.808v1.536c-0.512 30.72-25.6 55.808-56.32 55.808zM901.632 240.64H122.368c-30.72 0-55.808-25.088-55.808-55.808v-1.536c0-30.72 25.088-55.808 55.808-55.808h779.776c30.72 0 55.808 25.088 55.808 55.808v1.536c-0.512 30.72-25.6 55.808-56.32 55.808z" p-id="3802" fill="#ffffff"></path></svg>
<nav class="navbar navbar-expand-lg navbar-light fixed-top"> <span>
<!--<a class="navbar-brand" href="/"><img src="../assets/img/logos.png" height="25" title="六零起始页"></a>--> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-x"
<button class="navbar-toggler collapsed" style="border: none; outline: none;" fill="currentColor" id="x">
type="button" data-toggle="collapse" data-target="#navbarsExample05" aria-controls="navbarsExample05" <path fill-rule="evenodd" d="M11.854 4.146a.5.5 0 010 .708l-7 7a.5.5 0 01-.708-.708l7-7a.5.5 0 01.708 0z">
aria-expanded="false" aria-label="Toggle navigation"> </path>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-list-nested" <path fill-rule="evenodd" d="M4.146 4.146a.5.5 0 000 .708l7 7a.5.5 0 00.708-.708l-7-7a.5.5 0 00-.708 0z">
fill="currentColor" id="list-nested"> </path>
<path fill-rule="evenodd" d="M4.5 11.5A.5.5 0 015 11h10a.5.5 0 010 1H5a.5.5 0 01-.5-.5zm-2-4A.5.5 0 013 7h10a.5.5 0 010 1H3a.5.5 0 01-.5-.5zm-2-4A.5.5 0 011 3h10a.5.5 0 010 1H1a.5.5 0 01-.5-.5z"> </svg>
</path> <span>
</svg> </button>
<span> <div class="collapse navbar-collapse" id="navbarsExample05">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-x" <ul class="navbar-nav mr-auto">
fill="currentColor" id="x"> <li class="nav-item">
<path fill-rule="evenodd" d="M11.854 4.146a.5.5 0 010 .708l-7 7a.5.5 0 01-.708-.708l7-7a.5.5 0 01.708 0z"> <a class="nav-link" href="https://www.lylme.com" target="_blant">主页</a>
</path> </li>
<path fill-rule="evenodd" d="M4.146 4.146a.5.5 0 000 .708l7 7a.5.5 0 00.708-.708l-7-7a.5.5 0 00-.708 0z"> <li class="nav-item">
</path> <a class="nav-link" href="https://blog.lylme.com" target="_blant">博客</a>
</svg> </li>
</span> <li class="nav-item">
</button> <a class="nav-link" href="https://github.com/lylme" target="_blant">Github</a>
<div class="collapse navbar-collapse" id="navbarsExample05"> </li>
<ul class="navbar-nav mr-auto"> <li class="nav-item">
<li class="nav-item"> <a class="nav-link" href="https://blog.lylme.com/about.html" target="_blant">关于</a>
<a class="nav-link" href="https://www.lylme.com" target="_blant"> </li>
主页 </ul>
</a> <div id="main">
</li> <div id="show_date"></div>
<li class="nav-item"> <div id="show_time"></div>
<a class="nav-link" href="https://blog.lylme.com" target="_blant"> </div>
博客
</a> <div id="he-plugin-simple">
</li> </div>
<li class="nav-item">
<a class="nav-link" href="https://github.com/lylme" target="_blant"> <script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0">
Github </script>
</a> </div>
</li>
<li class="nav-item"> </nav>
<a class="nav-link" href="https://blog.lylme.com/about.html" target="_blant"> <!--topbar结束-->
关于 <div class="container" style="margin-top:10vh; position: relative; z-index: 100;">
</a> <h2 class="title">上网,从这里开始!</h2>
</li>
</ul> <?php
<div id="main">
<div id="show_date"> </div> $filename = './assets/data/data.dat'; //随机一言文件目录
</div>
<div id="show_time"></div> if (!file_exists($filename)) {
<div id="he-plugin-simple"> die($filename . ' Error');
</div> }
$data = file_get_contents($filename);
<script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"> $data = explode(PHP_EOL, $data);
</script> $result = $data[array_rand($data)];
</div> $result = str_replace(array("\r", "\n", "\r\n"), '', $result);
echo '<p class="content"><b>随机一言:</b>'.$result;
</nav> ?>
<!--topbar结束--> </p>
<div class="container" style="margin-top:10vh; position: relative; z-index: 100;"> <!--搜索开始-->
<div id="search" class="s-search">
<div id="search-list" class="hide-type-list">
<h2 class="title"> <div class="search-group group-a s-current" style=" margin-top: 50px;">
上网,从这里开始! <ul class="search-type">
</h2> <li>
<input checked="" hidden="" type="radio" name="type" id="type-baidu" value="<?php if($ua == "pc"){echo 'https://www.baidu.com/s?tn=simple&word=';}else{echo 'https://m.baidu.com/s?tn=simple&word=';}?>"
data-placeholder="百度一下,你就知道">
<label for="type-baidu">
<svg class="icon" aria-hidden="true">
<p class="content"><b>随机一言:</b> <use xlink:href="#icon-icon_baidulogo">
</use>
<?php </svg>
// 存储数据的文件 <span style="color:#0c498c;font-weight:600">
$filename = './assets/data/data.dat'; 百度一下
// 指定页面编码 </span>
// if (!file_exists($filename)) { </label>
// die($filename . ' Error'); </li>
// }
// 读取整个数据文件 <li>
$data = file_get_contents($filename); <input hidden="" type="radio" name="type" id="type-sogou" value="https://www.sogou.com/web?query="
// 按换行符分割成数组 data-placeholder="上网从搜狗开始">
$data = explode(PHP_EOL, $data); <label for="type-sogou" style="font-weight:600">
// 随机获取一行索引 <svg class="icon" aria-hidden="true">
$result = $data[array_rand($data)]; <use xlink:href="#icon-sougou">
// 去除多余的换行符 </use>
$result = str_replace(array("\r", "\n", "\r\n"), '', $result); </svg>
echo $result;?> <span style="color:#696a6d">
</p> 搜狗搜索
<!--搜索开始--> </span>
<div id="search" class="s-search"> </label>
<div id="search-list" class="hide-type-list"> </li>
<div class="search-group group-a s-current" style=" margin-top: 50px;">
<ul class="search-type"> <li>
<li> <input hidden="" type="radio" name="type" id="type-bing" value="https://cn.bing.com/search?q="
<input checked="" hidden="" type="radio" name="type" id="type-baidu" value="https://www.baidu.com/?tn=simple#&wd=" data-placeholder="微软必应搜索引擎">
data-placeholder="百度一下,你就知道"> <label for="type-bing" style="font-weight:600">
<label for="type-baidu"> <svg class="icon" aria-hidden="true">
<svg class="icon" aria-hidden="true"> <use xlink:href="#icon-bing">
<use xlink:href="#icon-icon_baidulogo"> </use>
</use> </svg>
</svg> <span style="color:#696a6d">
<span style="color:#0c498c;font-weight:600"> Bing必应
百度一下 </span>
</span> </label>
</label> </li>
</li> <li>
<li> <input hidden="" type="radio" name="type" id="type-zhihu" value="https://www.zhihu.com/search?q="
<input hidden="" type="radio" name="type" id="type-bing" value="https://cn.bing.com/search?q=" data-placeholder="有问题,上知乎">
data-placeholder="微软必应搜索引擎"> <label for="type-zhihu">
<label for="type-bing" style="font-weight:600"> <svg class="icon" aria-hidden="true">
<svg class="icon" aria-hidden="true"> <use xlink:href="#icon-zhihu">
<use xlink:href="#icon-bing"> </use>
</use> </svg>
</svg> <span style="color:#06f;font-weight:600">
<span style="color:#696a6d"> 知乎搜索
Bing必应 </span>
</span> </label>
</label> </li>
</li> <li>
<li> <input hidden="" type="radio" name="type" id="type-bilibili" value="https://search.bilibili.com/all?keyword="
<input hidden="" type="radio" name="type" id="type-sogou" value="https://www.sogou.com/web?query=" data-placeholder=" (゜-゜)つロ 干杯">
data-placeholder="上网从搜狗开始"> <label for="type-bilibili">
<label for="type-sogou" style="font-weight:600"> <svg class="icon" aria-hidden="true">
<svg class="icon" aria-hidden="true"> <use xlink:href="#icon-bili">
<use xlink:href="#icon-sougou"> </use>
</use> </svg>
</svg> <span style="color:#00aeec;font-weight:600">
<span style="color:#696a6d"> 哔哩哔哩
搜狗搜索 </span>
</span> </label>
</label> </li>
</li> <li>
<li> <input hidden="" type="radio" name="type" id="type-weibo" value="https://s.weibo.com/weibo/"
<input hidden="" type="radio" name="type" id="type-google" value="https://www.google.com.hk/search?hl=zh-CN&q=" data-placeholder="随时随地发现新鲜事">
data-placeholder="值得信任的搜索引擎"> <label for="type-weibo">
<label for="type-google" style="font-weight:600"> <svg class="icon" aria-hidden="true">
<svg class="icon" aria-hidden="true"> <use xlink:href="#icon-weibo">
<use xlink:href="#icon-google00"> </use>
</use> </svg>
</svg> <span style="color:#ff5722;font-weight:600">
<span style="color:#3B83FA"> 微博搜索
谷歌搜索 </span>
</span> </label>
</label> </li>
</li>
<li> <li>
<input hidden="" type="radio" name="type" id="type-bilibili" value="https://search.bilibili.com/all?keyword=" <input hidden="" type="radio" name="type" id="type-google" value="https://www.google.com.hk/search?hl=zh-CN&q="
data-placeholder=" (゜-゜)つロ 干杯"> data-placeholder="值得信任的搜索引擎">
<label for="type-bilibili"> <label for="type-google" style="font-weight:600">
<svg class="icon" aria-hidden="true"> <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-bili"> <use xlink:href="#icon-google00">
</use> </use>
</svg> </svg>
<span style="color:#00aeec;font-weight:600"> <span style="color:#3B83FA">
哔哩哔哩 谷歌搜索
</span> </span>
</label> </label>
</li> </li>
<li> <li>
<input hidden="" type="radio" name="type" id="type-weibo" value="https://s.weibo.com/weibo/" <input hidden="" type="radio" name="type" id="type-fanyi" value="https://translate.google.cn/?hl=zh-CN&sl=auto&tl=zh-CN&text="
data-placeholder="随时随地发现新鲜事"> data-placeholder="输入翻译内容(自动检测语言)后回车">
<label for="type-weibo"> <label for="type-fanyi">
<svg class="icon" aria-hidden="true"> <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-weibo"> <use xlink:href="#icon-fanyi">
</use> </use>
</svg> </svg>
<span style="color:#ff5722;font-weight:600"> <span style="color:#06f;font-weight:600">
微博搜索 在线翻译
</span> </span>
</label> </label>
</li> </li>
<li> </ul>
<input hidden="" type="radio" name="type" id="type-zhihu" value="https://www.zhihu.com/search?q=" </div>
data-placeholder="有问题,上知乎"> </div>
<label for="type-zhihu"> <form action="https://www.baidu.com/s?wd=" method="get" target="_blank"
<svg class="icon" aria-hidden="true"> id="super-search-fm">
<use xlink:href="#icon-zhihu"> <input type="text" id="search-text" placeholder="百度一下" style="outline:0"
</use> autocomplete="off">
</svg> <button class="submit" type="submit">
<span style="color:#06f;font-weight:600"> <svg style="width: 22px; height: 22px; margin: 0 20px 0 20px; color: #fff;"
知乎搜索 class="icon" aria-hidden="true">
</span> <use xlink:href="#icon-sousuo">
</label> </use>
</li> </svg>
<li> <span>
<input hidden="" type="radio" name="type" id="type-fanyi" value="https://translate.google.cn/?hl=zh-CN&sl=auto&tl=zh-CN&text=" </button>
data-placeholder="输入翻译内容,自动检测语言">
<label for="type-fanyi"> <ul id="word" style="display: none;">
<svg class="icon" aria-hidden="true"> </ul>
<use xlink:href="#icon-fanyi"> </form>
</use> <div class="set-check hidden-xs">
</svg> <input type="checkbox" id="set-search-blank" class="bubble-3" autocomplete="off">
<span style="color:#06f;font-weight:600"> </div>
在线翻译 </div>
</span>
</label> <?php
</li> include "include/list.php";
</ul> include "include/footer.php";
</div>
</div>
<form action="https://www.baidu.com/s?wd=" method="get" target="_blank"
id="super-search-fm">
<input type="text" id="search-text" placeholder="百度一下" style="outline:0"
autocomplete="off">
<button class="submit" type="submit">
<svg style="width: 22px; height: 22px; margin: 0 20px 0 20px; color: #fff;"
class="icon" aria-hidden="true">
<use xlink:href="#icon-sousuo">
</use>
</svg>
<span>
</button>
<ul id="word" style="display: none;">
</ul>
</form>
<div class="set-check hidden-xs">
<input type="checkbox" id="set-search-blank" class="bubble-3" autocomplete="off">
</div>
</div>
<?php
include "include/list.php";
include "include/footer.php";
?> ?>