Home > Article > Backend Development > php 无线级别分门别类 实现评论回复功能
php 无线级别分类 实现评论回复功能
header('Content-type:text/html; charset=utf-8');
echo $_SERVER["REMOTE_ADDR"]."
";
$sip=substr($_SERVER["REMOTE_ADDR"],10,12);
$eip=200;
if($sip>$eip){
echo "您的IP值为:".$_SERVER["REMOTE_ADDR"]."在规定的IP段位";
}
else{echo "您的IP值为:".$_SERVER["REMOTE_ADDR"]."不在规定的IP段位";}
echo "
";
echo "
无线级别分类
";
echo "";
//************************连接数据库*******************
$link=mysql_connect('localhost','root','') or die('链接失败');
mysql_select_db('test',$link) or die('链接数据库失败!');
@$content=$_REQUEST['content'];
if(isset($content) || $content!=''){
$sql1="insert into says(c_content,pid,path) values('".$content."','0','0');";
}else{
echo "别刷页面行不?有意思吗?";
}
@$oo=mysql_query($sql1);
if($oo){echo "发布成功!
";}else{echo "发布失败!
";}
$sql="select c_id,c_content,pid,path,concat(path,'-',c_id) as bpath from says order by bpath";
$rows=mysql_query("$sql");
//var_dump($row);
while($res=mysql_fetch_assoc($rows)){
echo "";
}
//***************************回复********************
@$contents=$_REQUEST['contents'];
if(isset($contents) || $contents!=''){
$bj=$_REQUEST['path']."-".$_REQUEST['id'];
$sql2="insert into says(c_content,pid,path) values('".$contents."','".$_REQUEST['id']."','".$bj."');";
}
@$aiyao=mysql_query($sql2);
if($aiyao){echo "回复成功!
";}else{echo "回复失败!
";}
?>
<script><br> $(".huifu").click(function(){<br> var str="<br />回复内容:<textarea id='contents' name='contents'><input type='submit' value='回复' />";<br> $(this).next().html(str);<br> })<br></script>