<?php
if(!defined('MOD'))  die("access die");
$rules = intval($_GET['rules']);
$string = new String();
$urls = urldecode($_GET['cuowuleurl'] );
$handles = qbase::load($urls);
$handles = htmlspecialchars( $handles );
$handles = preg_replace( "/\n/is", "<br>", $handles );
$sql = "SELECT * FROM ".TABLEPRE."collect_rule WHERE id = '$rules'";
$row = qdb::QueryFirst( $sql );
if(empty($row)) qbase::showmsg("出错了，请求的数据不存在");
$chars = preg_split( "/\[[^'\"<]*\]/is", $row['link_rule'] );
$num = count( $chars ) - 1;
for ( $i = 0; $i <= $num; $i++ ){
	$chars[$i] = htmlspecialchars( $chars[$i] );
	$links_rule = preg_replace( "/\n/is", "<br>", $chars[$i] );
	if ( $i == 0 ){
		$handles = str_replace( $links_rule, '<font color="#0000ff">'.$links_rule.'</font><font color="red">', $handles );
	}else if ( $i == $num ){
		$handles = str_replace( $links_rule, '</font><font color="#66ff33">'.$links_rule.'</font>', $handles );
	}else{
		$handles = str_replace( $links_rule, '</font><font color="#C0C0C0">'.$links_rule.'</font><font color="red">', $handles );
	}
}
include qbase::template( $path . '/' .  "file_link" );
?>
