www.gusucode.com > 渝海百度收录查询工具 1.3 > code/config.php

    <?php
/*
渝海软件[HaiPHP.COM] 
*/
require 'Textclass.php';
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->template_dir = "templates"; //模板文件目录
$smarty->compile_dir = "smarty/templates/templates_c";
$smarty->config_dir = "smarty/templates/config";
$smarty->cache_dir = "smarty/templates/cache";
$smarty->caching = false;

$file=fopen('list.txt',"a+");
if($file == FALSE)exit('<font color=red>无法创建或者打开list.txt</font>');

function __urljudge($url){
	$suffixes="com|net|org|gov|biz|com.tw|com.hk|com.ru|net.tw|net.hk|net.ru|info|cn|com.cn|net.cn|org.cn|gov.cn|mobi|name|sh|ac|la|travel|tm|us|cc|tv|jobs|asia|hn|lc|hk|bz|com.hk|ws|tel|io|tw|ac.cn|bj.cn|sh.cn|tj.cn|cq.cn|he.cn|sx.cn|nm.cn|ln.cn|jl.cn|hl.cn|js.cn|zj.cn|ah.cn|fj.cn|jx.cn|sd.cn|ha.cn|hb.cn|hn.cn|gd.cn|gx.cn|hi.cn|sc.cn|gz.cn|yn.cn|xz.cn|sn.cn|gs.cn|qh.cn|nx.cn|xj.cn|tw.cn|hk.cn|mo.cn|org.hk";
	if(!eregi("^(www\.)?([A-Za-z0-9-])+\.($suffixes)$",$url)){
		echo "<script language='javascript'>alert('您输入的网址不符合规格,请重新输入!');</script>";
		exit;
	}else {return $url;}
}

function get_real_ip(){
	$ip=false;
	if(!empty($_SERVER["HTTP_CLIENT_IP"])){
		$ip = $_SERVER["HTTP_CLIENT_IP"];
	}
	if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
		$ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
		if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }
		for ($i = 0; $i < count($ips); $i++) {
			if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i])) {
				$ip = $ips[$i];
				break;
			}
		}
	}
	return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}

$ip=get_real_ip();

$text_class=new CtbClass();

$date=mktime (date(H)-1, date(i), date(s), date(m), date(d), date(Y));

?>