<?php 
    
    require "../../Run.php";
 
    echo head('修改友情链接信息');
   if($login==1){              /*如果用户已经登录*/
	if($admin==1 || $admin == 2){
	
	if($_GET['sitelink_mod'] == 'yes'){
	$sql="UPDATE sitelink SET title='{$_POST["title"]}',content='{$_POST["content"]}',url='{$_POST[url]}' WHERE sitelinkid='{$_POST["sitelinkid"]}' AND siteid='".WAPID."'";
    $result=mysql_query($sql);
	echo "<div class=\"tip\">";
	if($result && mysql_affected_rows()>0){
	echo '<div class="tip">修改成功</div>';
    }else{
    echo '<div class="tip">修改失败</div>';
    };
	echo "<a href=\"mod.php?cid=".$_GET['cid']."&page=".$_GET['page']."&id=".$_POST['sitelinkid']."&sid=".$sid_info."\">返回友情链接习修改</a></div>";
	}else{
    $sql="SELECT sitelinkid,phone,title,content,v,time,gro,url,go,come,urlid,list FROM sitelink WHERE sitelinkid=
'{$_GET['id']}'";
    $view = mysql_query($sql);
    if($view && mysql_num_rows($view)>0){
    list($sitelinkid,$phone,$title,$content,$v,$time,$gro,$url,$go,$come,$urlid,$list) = mysql_fetch_row($view);
	echo '<div class="title">链接修改</div>
	<div class="content">';
	echo "<form method=\"post\" action=\"mod.php?sitelink_mod=yes&id=".$sitelinkid."&page=".$_GET['page']."&sid=".$sid_info."\">网站名称<br><input type=\"text\" name=\"title\" value=\"".$title."\">
    <input type=\"hidden\" name=\"sitelinkid\" value=\"".$_GET['id']."\">
	<input type=\"hidden\" name=\"cid\" value=\"".$_GET['cid']."\">
    <br>链接地址<br><input type=\"text\" name=\"url\"  value=\"".$url."\">
    <br>网站简介<br><textarea name=\"content\">".$content."</textarea>
    <br><input type=\"submit\" value=\"保存修改\">
	</form></div><div class=\"mylink\"><a href=\"list.php?cid=".$gro."&sid=".$sid_info."\">返回上级</a><a href=\"../../index.php?sid=".$sid_info."\">网站首页</a></div>";
		}else{
	    echo '<div class="title">链接修改</div><div class="tip">抱歉 内容获取失败，内容可能已经被删除！</div>';
	        }
		   }
        }else{
	    echo '<div class="title">链接修改</div><div class="tip">您无权进入此页面，请联系管理员！</div>';
		   }
	    }else{
		echo '<div class="title">链接修改</div><div class="tip">登录信息错误</div>';
		  }
    echo footer(1);
		 ?>         