<?php
	function yl_code (){

		$url = $_POST['url'];
		$qq = $_POST['qq'];

		if ($_GET['url'] == 'get'){
			return 'Case 1'; //载入本站信息
		}
		
		if (!empty ($url)){
			if (!empty ($qq)){
				if (strpos ('$_$'.$url.'$_$','http://')){
					if (yl_url ($url)){
						Send_out_Mail ($configure['mymail'],"[".$configure['webname']."] 友联申请","网站地址: ".$url."<br><br>QQ / 邮箱: ".$qq);
						return 'Case 3'; //申请友联成功
					}else{
						return 'Case 4'; //未添加本站友联
					}
				}else{
					return 'Case 2'; //网址格式错误
				}
			}else{
				return 'Case 5'; //联系方式为空
			}
		}else{
			return 'Case 6'; //载入友联申请页面
		}

	}

	function yl_url ($url){
		$data = file_get_contents ($url);
		if (strpos ($data,'http://aygq.cc/')){
			if (strpos ($data,'暗月挂Q') || strpos ($data,iconv('UTF-8','gb2312','暗月挂Q'))){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}


	$AnYue_Smarty -> assign ('info',yl_code());
	$AnYue_Smarty -> assign ('WebSite_Url',$WebSite_Url);
	$AnYue_Smarty -> display ('yl.html');

