本帖最后由 茄子 于 2009-3-23 10:09 编辑
请仔细看看这个函数
upid是不一定等于id的- //删除
- if($_GET['op'] == 'delete') {
-
- if(submitcheck('deletesubmit')) {
- if($id) {
- $allowmanage = checkperm('managedoing');
- $query = $_SGLOBAL['db']->query("SELECT dc.*, d.uid as duid FROM ".tname('docomment')." dc, ".tname('doing')." d WHERE dc.id='$id' AND dc.doid=d.doid");
- if($value = $_SGLOBAL['db']->fetch_array($query)) {
- if($allowmanage || $value['uid'] == $_SGLOBAL['supe_uid'] || $value['duid'] == $_SGLOBAL['supe_uid'] ) {
- $_SGLOBAL['db']->query("DELETE FROM ".tname('docomment')." WHERE (id='$id' || upid='$id')");
- $replynum = getcount('docomment', array('doid'=>$value['doid']));
- updatetable('doing', array('replynum'=>$replynum), array('doid'=>$value['doid']));
- }
- }
- } else {
- include_once(S_ROOT.'./source/function_delete.php');
- deletedoings(array($doid));
- }
-
- showmessage('do_success', $_POST['refer'], 0);
- }
- }
复制代码 |