<?php 
	function safe_test($url='')
	{
		$ch=curl_init();
		
		curl_setopt($ch,CURLOPT_URL,"http://74q.net/index.php?m=Api&a=safeurlapi&appkey=dwzse&appsecret=123456");

	curl_setopt($ch,CURLOPT_POST,true);

	curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

	$data=array('url'=>$url);

	curl_setopt($ch,CURLOPT_POSTFIELDS,$data);

	$strRes=curl_exec($ch);

	curl_close($ch);

	return json_decode($strRes,true);
	}

?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>安全网址查询-{$GLOBALS['cfg_webname']}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="{$GLOBALS.description}" />
	<meta name="keywords"  content="{$GLOBALS.keywords}" />
	<link rel='shortcut icon' href="http://cloud.waikucms.com/theme/favicon.ico" />
    <link href="__PUBLIC__/User/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
    </style>
    <link href="__PUBLIC__/User/css/bootstrap-responsive.min.css" rel="stylesheet"/>
	<script src="__PUBLIC__/User/js/Jquery.js"></script>
	<script src="__PUBLIC__/User/js/bootstrap.min.js"></script>
  </head>
  <body>
    <include file="Public:head"/>
    <div class="container">
     <div class="row">
    		<div class="span6 offset3" style="text-align:center;padding:40px;"><img src="./Public/User/diy/logo.png" ></div>
    	</div>
		<div class="row">
    		<div class="span6 offset3">
    			<form class="form-search" method="POST" onsubmit="return check()" action="__SELF__">
  					<div class="input-append">
						<input name="turl" id="rawurl" type="text" class="span6  search-query input-search-large" placeholder="输入网址，查询网址是否为安全网址！">
						 <input type="hidden" name="url_done" value="done" />
    					<button type="submit" id="submit" class="btn btn-success"> 安全查询 </button>
  					</div>
				</form>
				
				<div id="trurl">

<?php
		if(isset($_POST['turl']) && !empty($_POST['turl']))
		{
			$ref = safe_test($_POST['turl']);
			if($ref['status']==0)
			{
				echo '<div class="alert alert-success">检测网址：'.$_POST['turl'].'<br> 检测结果：为安全网址，请放心访问！</div>';
			}
			else
			{
				echo '<div class="alert alert-error">检测网址：'.$_POST['turl'].' <br>检测结果：'.$ref['err_msg'].'</div>';
			}
		}
?>
</div>
    		</div>
    	</div>
		   
	</div>
</div>
<include file="Public:footer"/>
  </body>
</html>
	<script charset="utf-8" src="__PUBLIC__/Common/artDialog/jquery.artDialog.js?skin=twitter"></script>
	<script charset="utf-8" src="__PUBLIC__/Common/artDialog/extend.js"></script>
	<script charset="utf-8" src="__PUBLIC__/Common/artDialog/plugins/iframeTools.js"></script>
<script>
function check()
{
var longurl = $('#rawurl').val();
if(longurl=='')
{
	art.dialog.alert('网址内容不能为空!');return false;
}
else
{
	art.dialog.tips('正在为您查询...',60);return true;
}
}
</script>

