2
webstack 钻芒博客二开typecho美化版外链转内链
source link: https://www.silencetime.com/archives/262/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
webstack 钻芒博客二开typecho美化版外链转内链
废话不多说!直接上代码!
Demo: 静谧时光导航
登录后台,编辑当前外观里,修改index.php
,修改onclick
里的链接如下
<?php while ($posts->next()): ?>
<div class="col-sm-3">
<?php if($this->options->isLink == '1'): ?>
<div class="xe-widget xe-conversations box2 label-info" onclick="window.open('<?php echo "/jump.php?link=".lock_url($posts->fields->url); ?>', '_blank')"
主题文件夹下新建function.php
写入加密解密函数
<?php
//改进后的算法
//加密函数
//$key可以改成你需要的
function lock_url($txt,$key='silencetime'){
$txt = $txt.$key;
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+";
$nh = rand(0,64);
$ch = $chars[$nh];
$mdKey = md5($key.$ch);
$mdKey = substr($mdKey,$nh%8, $nh%8+7);
$txt = base64_encode($txt);
$tmp = '';
$i=0;$j=0;$k = 0;
for ($i=0; $i<strlen($txt); $i++) {
$k = $k == strlen($mdKey) ? 0 : $k;
$j = ($nh+strpos($chars,$txt[$i])+ord($mdKey[$k++]))%64;
$tmp .= $chars[$j];
}
return urlencode(base64_encode($ch.$tmp));
}
//解密函数
function unlock_url($txt,$key='silencetime'){
$txt = base64_decode(urldecode($txt));
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+";
$ch = $txt[0];
$nh = strpos($chars,$ch);
$mdKey = md5($key.$ch);
$mdKey = substr($mdKey,$nh%8, $nh%8+7);
$txt = substr($txt,1);
$tmp = '';
$i=0;$j=0; $k = 0;
for ($i=0; $i<strlen($txt); $i++) {
$k = $k == strlen($mdKey) ? 0 : $k;
$j = strpos($chars,$txt[$i])-$nh - ord($mdKey[$k++]);
while ($j<0) $j+=64;
$tmp .= $chars[$j];
}
return trim(base64_decode($tmp),$key);
}
根目录下新建一个jump.php
,写入跳转内容和方法
此处内容需要评论回复后(F5刷新)方可阅读。
欢迎关注公众号,,不怎么更新,博客有新的比较好的内容会有发消息
最后修改:2021 年 11 月 22 日 04 : 37 PM
如果觉得我的文章对你有用,请随意赞赏
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK