<?php
include("../include/label.php");;
$action=SafeRequest("action","get","zr");
if($action=="add"){
		$SiteName=SafeRequest("SiteName","post","zr");
		$SiteUrl=SafeRequest("SiteUrl","post","zr");
		$SiteLogo=SafeRequest("SiteLogo","post","zr");
		$Types=SafeRequest("Types","post");
		$SiteDescription=SafeRequest("SiteDescription","post","zr");
		$sql="insert s_link (S_Name,S_Url,S_Pic,S_IsVerify,S_IsIndex,S_ClassID,S_Input) values ('".$SiteName."','".$SiteUrl."','".$SiteLogo."',1,1,".$Types.",'".$SiteDescription."')";
		if($db->query($sql)){
			die("<script>alert('申请成功请等待管理员审核!');window.location='link.php'</script>");
		}else{
			die("<script>alert('未知错误申请失败!');window.location='link.php'</script>");
		}	
}else{
?>
<!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=gb2312" />
<style type="text/css">body,td,th {
	font-size: 12px;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.mycode{
	float:left;
}   
.mycode ul{ 
	width:100%;
	list-style-type:none;
	list-style-image: url(../images/no.gif);
	
}   
.mycode li{ 
	width:150px; float:left; display:block; line-height:20px; list-style:inside; text-decoration:none; text-align:left;
}   

a {
	font-size: 12px;
}
a:link {
	text-decoration: none;
	color: #09C;
}
a:visited {
	text-decoration: none;
	color: #09C;
}
a:hover {
	text-decoration: underline;
	color: #09C;
}
a:active {
	text-decoration: none;
	color: #09C;
}
</style>
<title>申请友情链接_<?php echo S_SiteName?></title>
<script language="javascript">
	function check(){
		var name=document.getElementById("SiteName").value;
		var url=document.getElementById("SiteUrl").value;
		if(name==""){
			document.getElementById("info").innerHTML="&nbsp;&nbsp;&nbsp;请输入网站名称！";
			return false;
			}
		else if(url==""){
			document.getElementById("info").innerHTML="&nbsp;&nbsp;&nbsp;请输入网站地址！";
			return false;
			}
		else{
			form1.submit();
			}	
			
		}
</script>
</head>

<body>
<div style="height:30px; width:96%; margin:0 auto; background:url(../images/common/alert_title.jpg); line-height:30px; padding-left:30px; color:#FFF;"><strong>&nbsp;本站友情链接</strong></div>

<div style="width:96%; margin:0 auto; margin-bottom:20px; margin-top:10px;padding-bottom:10px; height:100%;">
	<div style="height:15px; width:100%; line-height:15px;"><div style="float:left"><img src="../images/common/link_bg.jpg"></div><div style="float:left">&nbsp;合作伙伴</div></div>
<?php
	global $db;
	$sql="select * from s_link where S_ClassID=2 order by s_id desc";
	$rs=$db->query($sql);
	$num=$db->num_rows($rs);
	for($i=0;$i<$num;$i++){
		$row=$db->fetch_array($rs);
?>
		<div style="float:left; margin-left:25px; height:30px;margin-top:10px;"><a href="<?php echo $row["S_Url"]?>" target="_blank"><img src="<?php echo $row["S_Pic"]?>" onerror="src='../images/nopic.gif'" width="90" height="33" border="0"></a></div>

<?php
        }
?>
    
</div>
<div style="clear:left;"></div>
	<div style="height:15px; width:96%; margin:0 auto; line-height:15px;"><div style="float:left"><img src="../images/common/link_bg.jpg"></div><div style="float:left">&nbsp;友情链接</div></div>
<div style="width:96%; margin:0 auto; margin-bottom:20px; margin-top:10px; height:100%;" class="mycode">
	<ul >
<?php
	global $db;
	$sql="select * from s_link where S_ClassID<>2 order by s_id desc";
	$rs=$db->query($sql);
	$num=$db->num_rows($rs);
	for($i=0;$i<$num;$i++){
		$row=$db->fetch_array($rs);
?>
 <li><img src="../images/common/links_10.gif">&nbsp;<a href="<?php echo $row["S_Url"]?>" target="_blank"><?php echo $row["S_Name"]?></a></li>
<?php
        }
?>
	</ul>
</div>
<div style="clear:left"></div>
<div style="height:30px; width:96%; margin:0 auto; background:url(../images/common/alert_title.jpg); line-height:30px; padding-left:30px; color:#FFF;"><strong>&nbsp;申请友情链接</strong></div>
<div style="width:96%; margin:0 auto; margin-top:20px;">
	<div style="width:50%; float:left; line-height:20px;">
	  <ul style="list-style:none;">
	    <li>&nbsp;<strong>申请步骤：</strong> </li>
      </ul>
      <ul  style="list-style:none;">
        <li>
          <div>1.请先在贵网站做好的文字友情链接：<br />
            链接文字：<?php echo S_SiteName?> 链接地址：<a href="<?php echo S_SiteDomain?>" target="_blank"><?php echo S_SiteDomain?></a></div>
        </li>
      </ul>
      <ul  style="list-style:none;">
        <li>2.做好链接后，请在右侧填写申请信息。</li>
      </ul>
      <ul  style="list-style:none;">
        <li>
          <div>3.已经开通我站友情链接，符合本站友情链接要求的网站，经管理员审核后，可以显示在此友情链接页面。</div>
        </li>
      </ul>
    </div>
    <div style="width:5%; float:left;">
    	<img src="../images/common/links.gif">
    </div>
    <div style="width:44%; float:left;">
        <form name="form1" id="form1" action="?action=add" method="post">
       	<div style="height:28px; line-height:28px; text-align:left;">&nbsp;&nbsp;&nbsp;<strong>申请信息</strong></div>
        <div style="width:100%;line-height:30px;">&nbsp;&nbsp;&nbsp;网站名称：&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="SiteName" id="SiteName" size="35"></div>
        <div style="width:100%;line-height:30px;">&nbsp;&nbsp;&nbsp;网站地址：&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="SiteUrl" id="SiteUrl" size="35"></div>
        <div style="width:100%;line-height:30px;">&nbsp;&nbsp;&nbsp;网站LOGO地址：<input type="text" name="SiteLogo" id="SiteLogo" size="35"></div>
         <div style="width:100%;line-height:30px;">&nbsp;&nbsp;&nbsp;网站说明：&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="SiteDescription" id="SiteDescription" size="35"  maxlength="100"/></div>
       <div style="width:100%;line-height:30px;"> &nbsp;&nbsp;&nbsp;友情链接类型：<input type="radio" id="Types" name="Types"  class="radio"  value="1" checked="checked"/> 文字<input type="radio" id="Types" name="Types"  class="radio"  value="2"/> 图片<input type="radio" id="Types" name="Types"  class="radio"  value="3" /> 合作伙伴</div>
        <div style="width:100%; height:30px; line-height:30px;">&nbsp;&nbsp;&nbsp;<input type="image" src="../images/common/btn_link.gif"  onclick="check();return false;" >&nbsp;<span id="info" style="color:red;"></span></div>
        </form>
    </div>
</div>
</body>
</html>
<?php
}
?>
