1 Star 0 Fork 0

鲁大学生网/shortUrl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.php 483 Bytes
一键复制 编辑 原始数据 按行查看 历史
JasonWung 提交于 2015-04-03 23:17 . 我同步了我本地的工作
<?php
include('./api/conn.php');
$short_url = $_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
echo $short_url;
$sql ="SELECT * FROM main WHERE short_url = '$short_url'";
$result = mysql_query($sql,$con);
$result = mysql_fetch_array($result);
if($result){
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://".$result['long_url']);
}else{
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://www.ldsn.net/");
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/ldsn/shortUrl.git
git@gitee.com:ldsn/shortUrl.git
ldsn
shortUrl
shortUrl
master

搜索帮助