<?php 
    
    require "../Run.php";
    
	require "../include/getmkurl.fun.php";
 
    echo head('提交友情链接');
   
	if($_POST['add'] == 'y'){

	if($_POST['title'] == NULL || $_POST['content'] == NULL){
	   die("标题内容均不能为空！");
	   }
	$time = time();
	$huilian = $_POST['url'].'_'.time();
	$sql = "INSERT INTO sitelink(title,url,content,time,gro,v,top,siteid,list,phone,go,come,urlid)VALUES('{$_POST['title']}','{$_POST['url']}','{$_POST['content']}','{$time}','{$_POST['cid']}','0','0','{$wapid}','0','{$_POST['phone']}','','','{$huilian}');"; 
	$sitelink = mysql_query($sql);
    if($sitelink && mysql_affected_rows()>0){
	echo "<div class=\"tip\">";
    echo "恭喜您，您的网址已经成功提交了，请等待管理员审核通过！<br>请在贵站添加本站的回链地址<br>回链地址:http://".$_SERVER["HTTP_HOST"]."/?link=".$huilian;
	echo "</div>";
	}else{
	echo "网址提交失败！请稍候再试或者联系网站管理员！";
	     }
	}
    echo "
	<div class=\"title\">友情链接提交</div>
	<div class=\"content\"><form method=\"post\" enctype=\"multipart/form-data\" action=\"add.php?cid=".$_GET['cid']."\"><input type=\"text\" name=\"title\"  value=\"网站名称\">
    <input type=\"hidden\" name=\"add\" value=\"y\">
    <input type=\"hidden\" name=\"cid\" value=\"".$_GET['cid']."\">
    <br>
  联系方式
    <br>
    <input type=\"text\" name=\"phone\" value=\"QQ:\">
    <br>
    栏目分类
    <br>";
    echo "<select name=\"gro\">";
	echo "<option value=\"".$_GET['cid']."\">".$_GET['cid']."_".class_name($_GET['cid'],'cn',$wapid)."</option>";
    $sql="SELECT cid,xuhao,cn,gro,q,url FROM class WHERE url='". get_mkid('sitelink/list')."' ORDER BY xuhao";
	/*执行数据查询语句*/  
	$result=mysql_query($sql);
	/*处理结果集*/
	if($result && mysql_num_rows($result)>0){
	$i=0;
    while(list($cid,$number,$cn,$class,$lmq,$urld)=mysql_fetch_row($result)){
	echo "<option value=\"".$cid."\">".$cid."_".$cn."</option>";
	    }
	}
	
    echo "</select><br>
    网站地址不加http://
    <br>
    <input name=\"url\" type=\"text\" value=\"\"><br>
    网站介绍
    <br>
    <input name=\"content\" type=\"text\" value=\"网站介绍\"><br>
    <br>
	<input type=\"submit\" value=\"上传文章\"></form></div>";
	echo "<div class=\"mylink\"><a href=\"list.php?cid=".$_GET['cid']."&sid=".$sid_info."\">返回上级</a><a href=\"../index.php?sid=".$sid_info."\">网站首页</a></div>";
	echo footer(1);
	  ?>	         