日期:2011-10-09  浏览次数:20543 次

 

配置文件
<?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
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>PHP100.com免费短地址</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: