<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("conn.php");

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$url=$ftbbsmb[10];

$ftbbs_class=ftbbs_request(trim($_POST["li"]));
$ftbbs_name=ftbbs_request(trim($_POST["name"]));
$ftbbs_url=ftbbs_request(trim($_POST["url"]));
$ftbbs_logo=ftbbs_request(trim($_POST["logo"]));
$ftbbs_qq=ftbbs_request(trim($_POST["qq"]));
$ftbbs_mail=ftbbs_request(trim($_POST["mail"]));
$ftbbs_zhu=ftbbs_request(trim($_POST["zhu"]));

$sql="select * from {$tablepre}links where ftbbs_name='".$ftbbs_name."'";
$rs=mysql_query($sql);
$row = mysql_fetch_array($rs);
$rsnum= mysql_num_rows($rs);
if ($rsnum!=0){
   echo "<script language=\"javascript\">alert(\"请不要重复申请!\");window.location=\"sqlink.php\";</script>";
   exit;
}
else{
$sql="insert into {$tablepre}links(ftbbs_class,ftbbs_name,ftbbs_url,ftbbs_logo,ftbbs_qq,ftbbs_mail,ftbbs_zhu,ftbbs_time) values('$ftbbs_class','$ftbbs_name','$ftbbs_url','$ftbbs_logo','$ftbbs_qq','$ftbbs_mail','$ftbbs_zhu','$getnow')";
mysql_query($sql);
echo "<script langugae=javascript>alert('友情链接添加成功!请做好本站的链接！');";
echo "window.location.href='sqlink.php';</script>";
exit;
}
?>