帖子管理模块
后台:
分页搜索显示页
1 2 3 4帖子管理 5 6 7 8 30 31 32 33
您的位置:帖子管理 > 帖子列表 | 36||||||||||||
39
| 52 ||||||||||||
55 56
| 196 ||||||||||||
条数据 / 页 首页 上一页 下一页 末页 | 199
doAction.php
1 0){ 25 echo ""; 26 }else{ 27 $sql="update post set elite=0 where id={ $_GET['id']}"; 28 $result=mysqli_query($link,$sql); 29 30 echo ""; 31 } 32 break; 33 34 //置顶 35 case "top": 36 37 //4.定义sql 38 $sql="update post set top=1 where id={ $_GET['id']}"; 39 $result=mysqli_query($link,$sql); 40 41 if($result && mysqli_affected_rows($link)>0){ 42 echo ""; 43 }else{ 44 $sql="update post set top=0 where id={ $_GET['id']}"; 45 $result=mysqli_query($link,$sql); 46 47 echo ""; 48 } 49 break; 50 51 //回收站 52 case "recycle": 53 54 $sql="update post set recycle=1 where id={ $_GET['id']}"; 55 56 $result=mysqli_query($link,$sql); 57 58 if($result && mysqli_affected_rows($link)>0){ 59 echo ""; 60 }else{ 61 $sql="update post set recycle=0 where id={ $_GET['id']}"; 62 $result=mysqli_query($link,$sql); 63 echo ""; 64 } 65 break; 66 67 //删除帖子 68 case "delete": 69 70 $sql="delete from post where id={ $_GET['id']}"; 71 $result=mysqli_query($link,$sql); 72 73 if($result && mysqli_affected_rows($link)>0){ 74 echo ""; 75 } 76 break; 77 //删除帖子回复 78 case "del": 79 80 $sql="delete from reply where id={ $_GET['id']}"; 81 $result=mysqli_query($link,$sql); 82 83 if($result && mysqli_affected_rows($link)>0){ 84 echo ""; 85 } 86 break; 87 88 case "update": 89 90 $set=array(); 91 if($_POST['title']!=""){ 92 $set[]="title='{ $_POST['title']}'"; 93 } 94 if($_POST['content']!=""){ 95 $set[]="content='{ $_POST['content']}'"; 96 } 97 if($_POST['recycle']!=""){ 98 $set[]="recycle='{ $_POST['recycle']}'"; 99 }100 101 $set=" set ".implode(",",$set);102 103 $sql="update post { $set} where id={ $_GET['id']}";104 $result=mysqli_query($link,$sql);105 106 if($result && mysqli_affected_rows($link)>0){107 echo "";108 }else{109 echo "";110 }111 112 113 break;114 115 }116 117 mysqli_close($link);118 119 ?>
前台
发帖mark.php
1 2 3 4 5 6 7 8 9 10 alert('请先登录后再发帖!');window.location.href='./login.php';"; 16 die(); 17 } 18 ?> 19 20 21 22 23 91 92 93 94 95 96 97 98 99 100
1 alert('请填写正确的标题和内容!!');window.location.href='../mark.php?tid={ $tid}';";die; 35 } 36 37 if($_POST['recycle']==2){ 38 $sql="insert post(uid,tid,title,content,ctime,recycle) values({ $uid},{ $tid},'{ $title}','{ $content}',{ $ctime},2)"; 39 }else{ 40 $sql="insert post(uid,tid,title,content,ctime) values({ $uid},{ $tid},'{ $title}','{ $content}',{ $ctime})"; 41 } 42 43 44 //4.定义sql语句发送并执行 45 46 $result=mysqli_query($link,$sql); 47 48 49 //5.判读是否插入成功 50 if($result && mysqli_affected_rows($link)>0){ 51 52 $id=mysqli_insert_id($link); 53 echo ""; 54 55 //发帖加分+100 56 $sql="update userdetail set fraction=fraction+10 where uid={ $uid}"; 57 mysqli_query($link,$sql); 58 } 59 60 break; 61 62 case "reply": 63 64 //回帖先判断登录状态 65 if(!isset($_SESSION['id'])){ 66 echo ""; 67 die; 68 } 69 $pid=$_GET['pid']; 70 //判断回复内容不能空 71 if($_POST['utxt']==""){ 72 73 74 echo ""; 75 die; 76 } 77 78 79 80 //获取回复时间 81 $time=time(); 82 //定义sql发送执行 83 $sql="insert reply values(null,{ $_SESSION['id']},{ $pid},'{ $_POST['utxt']}',{ $time})"; 84 $result=mysqli_query($link,$sql); 85 86 if($result && mysqli_affected_rows($link)>0 ){ 87 88 //回帖加分 89 $sql="update userdetail set fraction=fraction+5 where uid={ $_SESSION['id']}"; 90 mysqli_query($link,$sql); 91 92 echo ""; 93 die; 94 }else{ 95 echo ""; 96 die; 97 } 98 99 100 101 break;102 103 }104 105 //6.关闭链接106 mysqli_close($link);107 108 ?>