[php]
配置文件
[php]
<?php
/*網址設置*/
define(SITE,"http://xxx.com");//域名後面不要加/
/*API設置*/
define(API_KEY,"");//API,申請地址:http://qita.in/reg.php
/*高級設置*/
define(OPEN_AD,"0");//跳轉頁廣告開關,1表示開,0表示關.
define(AD,"我是廣告");//廣告內容,雙引號裡內容必須只能包含單引號
define(TIME,"3");//跳轉等待時間
?>
主要代碼
[php]
<?php
require_once('config.inc.php');
if(API_KEY==""){
echo "請修改config.inc.php API_KEY參數,<a href=http://qita.in/reg.php target=_blank>點擊注冊申請API</a>";
}
if(count($_GET['url'])>0){
//$url = "http://1dnet.net/index.php?api=1&return_url_text=1&longUrl=".$_GET['url'];
$url="http://qita.in/app.php?api=".API_KEY."&type=noad&url=".$_GET['url'];
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
//在需要用戶檢測的網頁裡需要增加下面兩行
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
//curl_setopt($ch, CURLOPT_USERPWD, US_NAME.":".US_PWD);
$contents = curl_exec($ch);
eregi('http://qita.in/(.*)',$contents,$new);
curl_close($ch);
if(strlen($contents)<8){
$shorturl="請輸入正確的短網址";
}
$shorturl=SITE."/$new[1]";
//echo "<a target=_blank href=http://$new[1]~s>[統計]</a>";
//echo '<input value="'.$contents.'">';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>7898.org免費短地址</title>
<META NAME="Description" CONTENT="126,網易短地址,短網址,短域名,短網址程序,淘寶短網址,短網址轉換,短網址還原,百度短網址">
<META NAME="Keywords" CONTENT="網易短地址,短網址,短域名,短網址程序,淘寶短網址,短網址轉換,百度短網址">
<link href="favicon.ico" type="image/ico" rel="shortcut icon">
<style>
a:link {color:#666;}
a:visited {text-decoration: none;color: #333;}
a:hover {text-decoration: none; color: #333;}
a:active {text-decoration: none;color: #CCC;}
body{margin:0px;background:url(bg_body.jpg) repeat-x;height:100%;text-align: center;}
.warp{margin:0 auto;width:620px;}img{border:none;}.c{clear:both;}.l{float:left;}.r{float:right;}ul,li{list-style:none;}
.main{margin:0 auto;width:620px;}
.logo{margin:20px auto;text-align:center;}
.logo a{font-size:50px}
.main p{text-align:center;color:#999;font-size:14px;}
.area{padding:10px;background:#f1f7f8;border:1px solid #cfe0e0;}
.text_are{float:left;width:440px;height:36px;padding:5px 0;border:1px solid #c6c6c6;font-size:16px;background:#ffffe6;}
.text_btn{float:left;margin-top:-1px;width:86px;height:36px;border:1px solid #c6c6c6;background:#f8f8f8;}
.list{float:left;margin-top:-1px;padding:9px;border:1px solid #cfe0e0;background:#FFF;font-size:12px;color:#999;}
.list td{padding:3px 5px;border-bottom:1px solid #e1edef;height:30px;}
.more a{color:#333;text-decoration:none;}
.footer{margin-top:15px;font-size:11px;color:#CCC;text-align:center;}
</style>
</head>
<body>
<div class="warp">
<div class="main">
<div class="logo"><a href="<?php echo SITE.'/index.php';?>" title="免費短地址">免費短地址</a></div>
<p>縮短、分享及監測你的鏈接
</p>
<div class="content" id="list" >
<div class="area">
<form action="<?php echo SITE;?>/index.php" method="get" id="post_form">
<input name="url" type="text" class="text_are" id="short_url" value="http://"/>
<input type="submit" class="text_btn" value="立即縮短"/>
</form>
<div class="c"></div>
</div>
<div class="list" style="width: 600px;">
<table width="600" border="0" cellpadding="0" cellspacing="0" id="list_url">
<tr>
<td bgcolor="#e4e4e4">短鏈接</td>
<td bgcolor="#e4e4e4">原始網址</td>
</tr>
<tr>
<td>
<?php
echo '<a href="'.$shorturl.'" target="_blank"><b>'.$shorturl.'</b></a></td>';
echo '<td>'.$_GET['url'].'</td>';
?>
</tr>
</table>
</div>
<div class="signdes">
</div>
</div>
</div>
</div>
<div class="footer">
<!--友情鏈接-->
</div>
<div style="display:none">
</div>
</body>
</html>
作者:liangxunli