Home > Backend Development > PHP Tutorial > php 无线级别分门别类 实现评论回复功能

php 无线级别分门别类 实现评论回复功能

WBOY
Release: 2016-06-13 11:38:04
Original
892 people have browsed it

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 "
";
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 "
";
$num=count(explode('-',$res['bpath']));
for($i=0;$iecho ' ';
}
    echo "发布人:".$res['c_id']."---------------"."发布内容:".$res['c_content']."回复".""."
";
}
//***************************回复********************
@$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>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template