1 Star 0 Fork 0

illi/Url-Short

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.php 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
Slurin 提交于 2015-06-24 11:24 . Enable redirection on .
<?php
define('TDIR',dirname(__FILE__));
//include_once TDIR.'/config.php';
if(isset($_REQUEST['go'])){
$a=base_convert($_GET['a'],36,10);
//if($a<300)$a=base_convert($_GET['a'],16,10);
$d=$a%100;
$g=($a-$d)/100;
if(!file_exists(TDIR.'/data/'.$g.'.php')){
$tv=array('URL Not Exists','go.notexists');
include_once TDIR.'/inctpl.php';
}else{
include_once TDIR.'/data/'.$g.'.php';
if(isset($t[$d])){
$tUrl=$t[$d];
switch($_GET['method']){
case 'click':
$tv=array('请点击链接跳转','go.click');
include_once TDIR.'/inctpl.php';
break;
case 'javascript':
$tv=array('正在跳转,请等待……','go.html');
$tv[3]='<script src="'.str_replace('//','/',strtr(dirname($_SERVER['SCRIPT_NAME']).'/jump.js','\\','/')).'" type="text/javascript"></script><script type="text/javascript">jumpTo("'.str_replace('"','\\"',$tUrl).'");</script>';
include_once TDIR.'/inctpl.php';
break;
case 'html':
$tv=array('正在跳转,请等待……','go.html');
$tv[3]='<meta http-equiv="refresh" content="1;url='.$tUrl.'"/>';
include_once TDIR.'/inctpl.php';
break;
case 'header':
header('Location: '.$tUrl);
break;
default:
header('Location: '.$tUrl);
break;
}
}else{
header('Location: /');
}
}
}elseif($_POST['url']){
$a=file_get_contents(TDIR.'/data/n.txt');
$d=$a%100;
$g=($a-$d)/100;
file_exists('data/'.$g.'.php') or file_put_contents('data/'.$g.'.php',"<?php\r\n");
file_put_contents('data/'.$g.'.php','$t['.$d.']=\''.$_POST['url'].'\';'."\r\n",FILE_APPEND);
file_put_contents('n.txt',$a+1);
$outUrl='http://'.$_SERVER['HTTP_HOST'].'/'.base_convert($a,10,36);
$tv=array('输出链接','output');
include_once TDIR.'/inctpl.php';
}else{
$tv=array('输入链接','mainform');
include_once TDIR.'/inctpl.php';
}
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ill/Url-Short.git
git@gitee.com:ill/Url-Short.git
ill
Url-Short
Url-Short
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385