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;$i<$num*2;$i++){
echo ' ';
}
    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 "回复失败!
";}


?>

你可能感兴趣的:(无线级别分类,php)