<?php
require ('authentication_manager.php');
?>
<?php

/* 管理员、版主管理执行 */
/* 162100源码 - 162100.com */


if (POWER < 2) {
  err('该命令必须以版主以上级身份登陆！请重登陆。');
}

function filter($text) {
  return (!preg_match('/[\s\"\']|^$/', $text) && $text != '');
}

if (!$limit = $_GET['limit']) {
  $limit = $_POST['limit'];
}
$_REQUEST['id'] = @array_unique((array)$_REQUEST['id']);
$_REQUEST['id'] = @array_filter($_REQUEST['id'], 'filter');

//$_REQUEST['id'] = array_filter($_REQUEST['id']);
//$_REQUEST['id'] = preg_grep('/^\d+$/', $_REQUEST['id']);

if (count($_REQUEST['id']) == 0) {
  err('参数出错！<br />问题分析：<br />1、您可能未点选<br />2、参数传递出错。');
}

@ require ('inc/function/filter.php');
@ require ('inc/function/write_file.php');
@ require ('inc/function/deldir.php');

$out = $this_key2 = '';

if (!isset($sql['db_err'])) {
  db_conn();
}
if ($sql['db_err'] != '') {
  err($sql['db_err']);
}

$sql['sql_version'] = @mysql_get_server_info();

if (isset($sql['sql_version']) && $sql['sql_version'] < '5.0') {
  err('服务器数据库版本（'.$sql['sql_version'].'）太低！本重要命令页禁止执行，以免出错。本程序建设基于MySQL版本5.0以上');
}


$result = @mysql_query('SELECT username,power FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE username="'.$session[0].'" LIMIT 1', $db);
$row_member = @mysql_fetch_assoc($result);
if (empty($row_member['username'])) {
  err('你不是合法管理者！数据库中查不到你。');
}
if ((POWER == 5 || POWER == 4) && $row_member['power'] != 'm') {
  err('你不是合法管理员！数据库中查不到你的管理员权限。');
}
if ((POWER == 3 || POWER == 2) && !preg_match('/^(\(\d+\-\d+\))+$/', $row_member['power'])) {
  err('你不是合法版主！数据库中查不到你的版主权限。');
}
@mysql_free_result($result);

$dataname = $_REQUEST['dataname'];


//重置栏目文章数
if ($dataname == 'reset_area_statistics') {
  if (POWER < 4) {
    err('该命令必须以管理员身份登陆！请重登陆。');
  }
  require ('inc/function/area_statistics.php');
  $area_arr = array();
  $result = @mysql_query('SELECT area_id FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id REGEXP "^[0-9]+\-[0-9]+$"', $db);
  if (@mysql_num_rows($result) > 0) {
    while ($row = @mysql_fetch_assoc($result)) {
      $area_arr[] = $row['area_id'];
      unset($row);
    }
  }
  @mysql_free_result($result);
  foreach ($_REQUEST['id'] as $i) {
    if (!in_array((string)$i, $area_arr)) {
      $out .= '<br />栏目分类'.$i.'不存在！';
      continue;
    }
    add_total((string)$i, $db);
    add_today((string)$i, $db);
    if ($_POST['area_mark_reset'] == 1) {
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' SET area_mark='.get_area_mark().' WHERE area_id="'.$i.'"', $db);
    }
    unset($i);
  }


//重置热门标签
} elseif ($dataname == 'reset_area_mark') {
  if (POWER < 4) {
    err('该命令必须以管理员身份登陆！请重登陆。');
  }
  require ('inc/function/hot_mark.php');


//删除上传夹
} elseif ($dataname == 'upload') {
  if (POWER < 4) {
    err('该命令必须以管理员身份登陆！请重登陆。');
  }
  if ($limit == 'del_upload') {
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title="'.implode('" OR title="', $_REQUEST['id']).'"', $db);
    foreach ($_REQUEST['id'] as $i) {
      @unlink('__temp__/temp/'.urlencode($i));
    }
    //alert('删除上载文件成功！', 'webmaster_central.php?get=upload');

  } elseif ($limit == 'clear_upload') {
    set_time_limit(60);
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "info-%" OR title LIKE "reply-%" OR title LIKE "mess-%" OR title LIKE "mail-%" OR title LIKE "thumb-%" OR title LIKE "thuml-%"', $db);
    foreach ((array)@glob('__temp__/temp/{info,reply,mess,mail,thumb,thuml}-*', GLOB_BRACE) as $f) {
      @unlink($f);
    }
    //alert('清理上载文件目录成功！', 'webmaster_central.php?get=upload');

  } elseif ($limit == 'del_ip') {
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE id="'.implode('" OR id="', $_REQUEST['id']).'"', $db);
    //alert('解除IP屏蔽成功！', 'webmaster_central.php?get=ip');

  } elseif ($limit == 'clear_ip') {
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE type="ip"', $db);
    //alert('一键解除全部屏蔽成功！', 'webmaster_central.php?get=ip');

  } elseif ($limit == 'delface') {
    if ($_POST['delsendmess'] == 1) {
      $this_key2 = '@mysql_query(\'UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET mess=IF(SUBSTRING(mess_num,INSTR(mess_num,"/")+1,LENGTH(mess_num))<'.$web['mess_count'].',CONCAT("'.gmdate('YmdHis', time() + floatval($web['time_pos']) * 3600).'|管理员|头像删除通知|<p>您好：<br />您的头像在最近的审核中没有通过，并被删除。<br />请您认真遵守站内规则</a>，以便成功发布推广您的信息。</p>||| \n",mess),mess),mess_num=IF(SUBSTRING(mess_num,INSTR(mess_num,"/")+1,LENGTH(mess_num))<'.$web['mess_count'].',CONCAT(ABS(mess_num)+1,"/",SUBSTRING(mess_num,INSTR(mess_num,"/")+1,LENGTH(mess_num))+1),mess_num) WHERE username="\'.$i.\'"\', $db);';
      $out .= '已向被删者发送短信。';
    }
    require ('inc/set/set_userface.php');
    foreach ($_REQUEST['id'] as $i) {
      @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "face-'.$i.'.%"', $db);
      eval($this_key2);
      @unlink('__temp__/temp/face-'.urlencode($i).'.'.$web['img_up_format'].'');
    }

  } elseif ($limit == 'clear_face') {
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "face-%"', $db);
    foreach ((array)@glob('__temp__/temp/face-*') as $f) {
      @unlink($f);
    }

  } else {
    err('命令错误！');
  }


//信誉管理
} elseif ($dataname == 'myaccount') {
  if (POWER < 4) {
    err('该命令必须以管理员身份登陆！请重登陆。');
  }
  $_REQUEST['id'] = preg_grep('/^\d+$/', $_REQUEST['id']);
  $id_key = '('.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'.id="'.implode('" OR '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'.id="', $_REQUEST['id']).'")';
  //信誉审核通过
  if ($limit == 'check_credit') {
    if (is_numeric($_POST['credit_value']) && $_POST['credit_value'] > 0) {
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' SET check_credit="0",money="'.$_POST['credit_value'].'" WHERE '.$id_key.' AND type="1" AND check_credit<>"0"', $db);
    }/* else {
      err('建议给人家加点信誉值。');
    }*/
    if (is_numeric($_POST['funds_value']) && $_POST['funds_value'] > 0) {
      $step = 0;
      foreach ($_REQUEST['id'] as $i) {
        @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`) VALUES ("'.str_replace('.', '&#46;', $_REQUEST['username'][$i]).'","0","'.$_REQUEST['description'][$i].'验证","'.$_POST['funds_value'].'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND))', $db);
        $step += 10;
      }
    }
    //alert('执行完毕！', $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : 'webmaster_central.php?get=member_credit');

  //信誉审核不通过
  } elseif ($limit == 'check_credit_warning') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' SET check_credit="2"  WHERE '.$id_key.' AND check_credit="1"', $db);

  //信誉记录删除
  } elseif ($limit == 'delcredit') {
    //清理上传夹
    foreach ($_REQUEST['id'] as $id) {
      @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title="'.urldecode($_REQUEST['other'][$id]).'"', $db);
      if (file_exists('__temp__/temp/'.$_REQUEST['other'][$id])) @unlink('__temp__/temp/'.$_REQUEST['other'][$id]);
    }
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE '.$id_key.' AND type="1"', $db);

  //货币记录删除
  } elseif ($limit == 'delfunds') {
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE '.$id_key.' AND type="0"', $db);

  } else {
    err('命令错误！');
  }


//用户管理
} elseif ($dataname == 'member') {
  if (POWER < 4) {
    err('该命令必须以管理员身份登陆！请重登陆。');
  }
  $_REQUEST['id'] = str_replace('.', '&#46;', $_REQUEST['id']);
  $_REQUEST['id'] = preg_replace('/^'.preg_quote($web['manager'], '/').'$/i', '', $_REQUEST['id']);
  $_REQUEST['id'] = array_filter($_REQUEST['id']);
  if (count($_REQUEST['id']) == 0) {
    err('没有选中项！（不含管理员）');
  }
  $id_key = '(username="'.implode('" OR username="', $_REQUEST['id']).'")';

  if ($limit == 'delcompany') {
    if ($_POST['delsendmess'] == 1) {
      $this_key2 = '",mess=IF(SUBSTRING(mess_num,INSTR(mess_num,\"/\")+1,LENGTH(mess_num))<'.$web['mess_count'].',CONCAT(\"'.gmdate('YmdHis', time() + floatval($web['time_pos']) * 3600).'|管理员|商号删除通知|<p>您好：<br />您的商号在最近的审核中没有通过，并被删除。<br />请您认真遵守站内规则</a>，以便成功发布商号及推广信息。</p>||| \n\",mess),mess),mess_num=IF(SUBSTRING(mess_num,INSTR(mess_num,\"/\")+1,LENGTH(mess_num))<'.$web['mess_count'].',CONCAT(ABS(mess_num)+1,\"/\",SUBSTRING(mess_num,INSTR(mess_num,\"/\")+1,LENGTH(mess_num))+1),mess_num)"';
      $out .= '已向被删者发送短信。';
    }
    foreach ($_REQUEST['id'] as $i) {
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET company="",company_description="",sign=""'.eval('return '.$this_key2.';').' WHERE username="'.$i.'"', $db);
    }
    //alert('删除商号成功！', 'webmaster_central.php?get=company');

  } elseif ($limit == 'out_punished') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET check_reg="0" WHERE '.$id_key.' AND check_reg="2"', $db);

  } elseif ($limit == 'check_reg') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET check_reg="0" WHERE '.$id_key.' AND check_reg="1"', $db);

  } elseif ($limit == 't' || $limit == 'r' || $limit == 'u' || $limit == 'a') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET power='.(($limit == 'a' && $row_member['power'] != 'm') ? '"a"' : 'CONCAT_WS("",REPLACE(power,"'.$limit.'",""),"'.$limit.'")').' WHERE '.$id_key.'', $db);

  } elseif ($limit == 'tt' || $limit == 'rr' || $limit == 'uu' || $limit == 'aa') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET power='.(($limit == 'aa' && $row_member['power'] != 'm') ? '""' : 'REPLACE(power,"'.substr($limit, 0, 1).'","")').' WHERE '.$id_key.'', $db);

  } elseif ($limit == 'addadmin') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET power="m" WHERE '.$id_key.' AND power<>"m"', $db);

  } elseif ($limit == 'deladmin') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET power="" WHERE '.$id_key.' AND power="m"', $db);

  } elseif (is_numeric($_POST['addfunds']) && $_POST['addfunds'] > 0) {
    foreach ($_REQUEST['id'] as $i) {
      @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`) VALUES ("'.$i.'","0","管理员加赠","'.$_POST['addfunds'].'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR))', $db);
    }

  } elseif (is_numeric($_POST['delfunds']) && $_POST['delfunds'] > 0) {
    foreach ($_REQUEST['id'] as $i) {
      @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`) VALUES ("'.$i.'","0","管理员减扣","-'.$_POST['delfunds'].'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR))', $db);
    }

  } elseif (is_numeric($_POST['addpoint']) && $_POST['addpoint'] > 0) {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET point=point+'.$_POST['addpoint'].' WHERE '.$id_key.'', $db);

  } elseif (is_numeric($_POST['delpoint']) && $_POST['delpoint'] > 0) {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET point=IF(point-'.$_POST['delpoint'].'>0,point-'.$_POST['delpoint'].',"0") WHERE '.$id_key.'', $db);

  } elseif (is_numeric($_POST['addcredit']) && $_POST['addcredit'] > 0) {
    foreach ($_REQUEST['id'] as $i) {
      @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`) VALUES ("'.$i.'","1","管理员加赠","'.$_POST['addcredit'].'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR))', $db);
    }

  } elseif (is_numeric($_POST['delcredit']) && $_POST['delcredit'] > 0) {
    foreach ($_REQUEST['id'] as $i) {
      @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`) VALUES ("'.$i.'","1","管理员减扣","-'.$_POST['delcredit'].'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR))', $db);
    }

  } elseif ($limit == 'del') {
    //更新统计**************************************************
    //@mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total=IF('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total-1>0,'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total-1,0),'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today=IF('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.date="'.$year.$date.'" AND SUBSTRING('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today,5)-1>0,CONCAT("'.$date.'",SUBSTRING('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today,5)-1),"'.$date.'0") WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_id=SUBSTRING_INDEX('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id,"_",1)', $db);
    @mysql_query('DELETE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].','.$sql['pref'].''.$sql['data']['承载关键词的表名'].','.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' LEFT JOIN ('.$sql['pref'].''.$sql['data']['承载关键词的表名'].','.$sql['pref'].''.$sql['data']['承载回复评论的表名'].') ON '.$sql['pref'].''.$sql['data']['承载关键词的表名'].'.id='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.r_id='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id WHERE ('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.author_ip="'.implode('" OR '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.author_ip="', $_REQUEST['id']).'")', $db);
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' WHERE (author_ip="'.implode('" OR author_ip="', $_REQUEST['id']).'")', $db);

    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE '.$id_key.'', $db);
    @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE '.$id_key.'', $db);
    if ($_REQUEST['delcomplete'] == 1) {
      @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE '.$id_key.'', $db);
    } else {
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET check_reg="2",thisdate=DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR),other="'.@implode('，', (array)$_REQUEST['delcomplete_reason']).'" WHERE '.$id_key.'', $db);
    }
    foreach ($_REQUEST['id'] as $id) {
	  if ($id == $web['manager']) {
        $out .= '管理员无法删除。';
        continue;
      }
      //清理上传夹
      //略
    }
    $_REQUEST['id'] = array_map('urlencode', $_REQUEST['id']);
    /****************************************************************/
    //require ('inc/function/hot_user.php');
    require ('inc/function/company_update.php');
    /****************************************************************/

  } elseif ($limit == 'del_') {
    if (empty($_REQUEST['del_1'])) {
      err('请填离线时间（不活跃的天数）！');
    }
    if (!(is_numeric($_REQUEST['del_1']) && $_REQUEST['del_1'] > 0)) {
      err('不活跃天数请填大于0的数字！');
    }
    @mysql_query('DELETE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].','.$sql['pref'].''.$sql['data']['承载财务数据的表名'].','.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' LEFT JOIN '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].','.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' ON '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'.username='.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username AND '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].'.username='.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username WHERE ('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.writecount="0" AND '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.replycount="0") AND '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.thisdate<DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) - $_REQUEST['del_1'] * 24).' HOUR)', $db); // '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.check_reg="" AND

  } elseif ($limit == 'del_badorder') {
    foreach ($_REQUEST['id'] as $v) {
      if (file_exists('__temp__/order/'.$v.'.txt')) {
        @unlink('__temp__/order/'.$v.'.txt');
      }
    }

  } else {
    err('命令错误！');
  }


//回帖管理
} elseif ($dataname == 'reply') {
  $_REQUEST['id'] = preg_grep('/^\d+$/', $_REQUEST['id']);
  if (POWER == 3 || POWER == 2) {
    $where_key = ' AND ('.trim(preg_replace('/\((\d+\-\d+)\)/', ''.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id="$1" OR '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id LIKE "$1\_%" OR ', $row_member['power']), ' OR').')';

  }

  //审核不通过
  if ($limit == 'check_reply_warning') {
    foreach ($_REQUEST['id'] as $k => $v) {
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.area_check_reply="2" WHERE '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id='.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.r_id'.$where_key.'', $db);
    }
    if ($_REQUEST['m'] == 1) {
      err('<script> var obj=parent.$(\'reply_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  //审核通过
  } elseif ($limit == 'check_reply') {
    foreach ($_REQUEST['id'] as $k => $v) {
      $result = @mysql_query('SELECT '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.*,'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.topdate FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' WHERE '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.area_check_reply<>"0" AND '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id='.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.r_id'.$where_key, $db);
      if ($row = @mysql_fetch_assoc($result)) {
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' SET area_check_reply="0" WHERE id="'.$v.'"', $db);
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET reply=reply+1,other="'.$row['author_ip'].'"'.($web['re_update'] == 1 ? ',topdate=IF(topdate<DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR),DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR),topdate)' : '').' WHERE id="'.$row['r_id'].'"', $db);
        if (!strstr($row['author_ip'], '.')) {
          @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET point=point+'.abs($web['replyadd']).',replycount=replycount+1 WHERE username="'.$row['author_ip'].'"', $db);
        }
        unset($row);
      }
      @mysql_free_result($result);
    }
    if ($_REQUEST['m'] == 1) {
      err('<script> var obj=parent.$(\'reply_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  //删除——审核中
  } elseif ($limit == 'del_check_reply') {
    require ('inc/function/cutstr.php');
    if ($_POST['delsendmess'] == 1) {
      $this_key2 = '"'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(\"".$date."|管理员|回帖删除通知|<p>您好：<br />您".$row["date"]."发表的回帖：</p><blockquote><b>".cutstr($row["text"], 150)."</b></blockquote><p>在最近的审核中没有通过，并被删除。<br />请您仔细阅读<a href=help.php#write_2 target=_blank>发表规则</a>，以便成功发布推广您的信息。</p>||| \n\",'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(ABS('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)+1,\"/\",SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))+1),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)"';
      $out .= '已向被删者发送短信。';
    }

    $step = 0;
    foreach ($_REQUEST['id'] as $k => $v) {
      $step += 10;
      $date = gmdate('YmdHis', time() + (floatval($web['time_pos']) * 3600) + $step);
      //$result = @mysql_query('SELECT A.author_ip AS u_r,A.r_id,A.text,A.date,B.area_id,B.author_ip AS u_w FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' AS A,'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' AS B WHERE A.id="'.$v.'" AND B.id=A.r_id', $db);
      $result = @mysql_query('SELECT A.author_ip AS u_r,A.r_id,A.text,A.date,B.area_id,B.author_ip AS u_w FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' AS A LEFT JOIN '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' AS B ON B.id=A.r_id WHERE A.id="'.$v.'"', $db);
      $row = @mysql_fetch_assoc($result);
      @mysql_free_result($result);
      if (is_array($row) && count($row) > 0) {
        if (POWER < 4 && !strstr($row_member['power'], '('.get_arearoot($row['area_id']).')')) continue;
        if (!empty($this_key2)) {
          if (!strstr($row['u_r'], '.')) {
            @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET '.eval('return '.$this_key2.';').' WHERE username="'.$row['u_r'].'"', $db);
          }
        }
        //清理上传夹
        @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "reply-'.$row['r_id'].'_'.$v.'-%"', $db);
        foreach ((array)@glob('__temp__/temp/reply-'.$row['r_id'].'_'.$v.'-*') as $f) @unlink($f);

        @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' WHERE id="'.$v.'"', $db);
        unset($row);
      }
    }
    if ($_REQUEST['m'] == 1) {
      err('<script> var obj=parent.$(\'reply_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  //删除
  } elseif ($limit == 'del') {
    require ('inc/function/cutstr.php');
    $this_key1 = $_POST['del_type_from'] != 'manager_check_reply' ? ''.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point=IF('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point-'.abs($web['replyadd']).'>0,'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point-'.abs($web['replyadd']).',0),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.replycount=IF('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.replycount-1>0,'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.replycount-1,0)' : '';
    if ($_POST['delsendmess'] == 1) {
      $this_key2 = '"'.($this_key1 ? ',' : '').''.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(\"".$date."|管理员|回帖删除通知|<p>您好：<br />您".$row["date"]."发表的回帖：</p><blockquote><b>".cutstr($row["text"], 150)."</b></blockquote><p>在最近的复审中被删除。<br />请您仔细阅读<a href=help.php#write_2 target=_blank>发表规则</a>，以便成功发布推广您的信息。</p>||| \n\",'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(ABS('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)+1,\"/\",SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))+1),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)"';
      $out .= '已向被删者发送短信。';
    }

    $step = 0;
    foreach ($_REQUEST['id'] as $k => $v) {
      $step += 10;
      $date = gmdate('YmdHis', time() + (floatval($web['time_pos']) * 3600) + $step);
      $result = @mysql_query('SELECT A.author_ip AS u_r,A.r_id,A.text,A.date,B.area_id,B.author_ip AS u_w FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' AS A LEFT JOIN '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' AS B ON B.id=A.r_id WHERE A.id="'.$v.'"', $db);
      $row = @mysql_fetch_assoc($result);
      @mysql_free_result($result);
      if (is_array($row) && count($row) > 0) {
        if (POWER < 4 && !strstr($row_member['power'], '('.get_arearoot($row['area_id']).')')) continue;
        if (!empty($this_key1) || !empty($this_key2)) {
          if (!strstr($row['u_r'], '.')) {
            @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET '.$this_key1.eval('return '.$this_key2.';').' WHERE username="'.$row['u_r'].'"', $db);
          }
        }
        //清理上传夹
        @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "reply-'.$row['r_id'].'_'.$v.'-%"', $db);
        foreach ((array)@glob('__temp__/temp/reply-'.$row['r_id'].'_'.$v.'-*') as $f) @unlink($f);

        @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' WHERE id="'.$v.'"', $db);
        unset($row);
      }
    }
    if ($_REQUEST['m'] == 1) {
      err('<script> var obj=parent.$(\'reply_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  } else {
    err('命令错误！');
  }


//文章管理
} elseif ($dataname == 'listdata') {
  $_REQUEST['id'] = preg_grep('/^\d+$/', $_REQUEST['id']);
  $id_key = '('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.implode('" OR '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="', $_REQUEST['id']).'")';
  if (POWER == 3 || POWER == 2) {
    $where_key = ' AND ('.trim(preg_replace('/\((\d+\-\d+)\)/', ''.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id="$1" OR '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id LIKE "$1\_%" OR ', $row_member['power']), ' OR').')';
  }

  //首页图文展示
  if ($limit == 'ess_index') {
    @ require ('inc/function/img.php');
    foreach ($_REQUEST['id'] as $k => $v) {
      $result = @mysql_query('SELECT * FROM `'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'` WHERE id="'.$v.'" AND title_mark LIKE "%图%"'.$where_key.'', $db);
      if ($row = @mysql_fetch_assoc($result)) {
        if (!strstr($row['author_ip'], '.')) {
          $arr_author[$row['author_ip']] = abs($arr_author[$row['author_ip']]) + 1;
          $arr_article[$row['author_ip']] .= '，'.$row['id'];
        }
        //首页图文推荐，生成缩略图1.4+加
          $temp_thumb = 'thumb';
          if (preg_match('/<img [^>]*src[\s\r\n]*=(?![\s\r\n]*\"?('.preg_quote($web['path'], '/').')?inc\/images\/)[^>]*>/i', $row['text'], $mi)) {
            $thumb = preg_replace('/.+src[\s\r\n]*=[\s\r\n]*(\"|\')?([^\"\>\s]+\.(gif|jpg|png)).+/i', '$2', $mi[0]);
            $thumb_format = strtolower(ltrim(strrchr($thumb, '.'), '.'));
            $thumb_here = '__temp__/temp/'.$temp_thumb.'-'.$v.'.'.$thumb_format.'';
            if (stristr($thumb, 'obj.php?title=')) {
              $thumb = substr($thumb, 14);
              if (file_exists('__temp__/temp/'.$thumb)) {
                $thumb_contents = @file_get_contents('__temp__/temp/'.$thumb);
              } else {
                $result_e = @mysql_query('SELECT `text` FROM `'.$sql['pref'].''.$sql['data']['承载上传数据的表名'].'` WHERE title LIKE "thumb-'.$v.'.%" OR title LIKE "info-'.$v.'-%" LIMIT 1', $db);
                if ($row_e = @mysql_fetch_assoc($result_e)) {
                  $thumb_contents = $row_e['text'];
                  unset($row_e);
                }
                @mysql_free_result($result_e);
              }
            } else {
              $thumb_contents = @file_get_contents($thumb);
            }
            if ($thumb_contents) {
              write_file($thumb_here, $thumb_contents);
              //if (run_img_resize($thumb_here, $thumb_here, 120, false, 75)) {
              run_img_resize($thumb_here, $thumb_here, 120, false, 75);
                $thumb_here = typeto($thumb_here, 'jpg');
                if ($thumb_content = @file_get_contents($thumb_here)) {
                  @mysql_query('REPLACE INTO `'.$sql['pref'].''.$sql['data']['承载上传数据的表名'].'` (`title`,`text`,`type`,`username`,`date`) VALUES ("'.basename($thumb_here).'","'.addslashes($thumb_content).'","image/jpeg","'.$row['author_ip'].'","2037-'.gmdate("m-d H:i:s", time() + (floatval($web["time_pos"]) * 3600)).'")', $db);
                  unset($thumb, $thumb_format, $thumb_here, $thumb_contents, $thumb_content);
                }
              //}
            }
          }
        //over
        unset($row);
      }
      @mysql_free_result($result);
    }
    if (count($arr_author) > 0) {
      $step = 0;
      foreach ($arr_author as $username => $size) {
        if (abs($_POST['credit_value']) > 0) {
          @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`,`other`) VALUES ("'.$username.'","1","文章被首页图文展示","'.(abs($_POST['credit_value']) * $size).'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND),"文章ID：'.ltrim($arr_article[$username], '，').'")', $db);
          $step += 10;
        }
        if (abs($_POST['funds_value']) > 0) {
          @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`,`other`) VALUES ("'.$username.'","0","文章被首页图文展示","'.(abs($_POST['funds_value']) * $size).'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND),"文章ID：'.ltrim($arr_article[$username], '，').'")', $db);
          $step += 10;
        }
      }
    }

  //撤展首页图文展示
  } elseif ($limit == 'cess_index') {
    foreach ($_REQUEST['id'] as $k => $v) {
      @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "thumb-'.$v.'.%"', $db);
      @unlink('__temp__/temp/thumb-'.$v.'.jpg');
      @unlink('__temp__/temp/thumb-'.$v.'.gif');
      @unlink('__temp__/temp/thumb-'.$v.'.png');
    }

  //推荐
  } elseif ($limit == 'ess') {
    foreach ($_REQUEST['id'] as $k => $v) {
      //$result = @mysql_query('SELECT * FROM `'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'` WHERE id="'.$v.'" AND title_mark NOT LIKE "%[荐]%"'.$where_key.'', $db);
      $result = @mysql_query('SELECT * FROM `'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'` WHERE id="'.$v.'" AND title_mark NOT LIKE "%[荐]%"'.$where_key.'', $db);
      if ($row = @mysql_fetch_assoc($result)) {
        if (!strstr($row['author_ip'], '.')) {
          $arr_author[$row['author_ip']] = abs($arr_author[$row['author_ip']]) + 1;
          $arr_article[$row['author_ip']] .= '，'.$row['id'];
        }
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET title_mark=CONCAT("[荐]",title_mark) WHERE id="'.$v.'"', $db);
        unset($row);
      }
      @mysql_free_result($result);
    }
    if (count($arr_author) > 0) {
      $step = 0;
      foreach ($arr_author as $username => $size) {
        if (abs($_POST['credit_value']) > 0) {
          @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`,`other`) VALUES ("'.$username.'","1","文章被推荐","'.(abs($_POST['credit_value']) * $size).'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND),"文章ID：'.ltrim($arr_article[$username], '，').'")', $db);
          $step += 10;
        }
        if (abs($_POST['funds_value']) > 0) {
          @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`,`other`) VALUES ("'.$username.'","0","文章被推荐","'.(abs($_POST['funds_value']) * $size).'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND),"文章ID：'.ltrim($arr_article[$username], '，').'")', $db);
          $step += 10;
        }
      }
    }

  //撤精
  } elseif ($limit == 'cess') {
    foreach ($_REQUEST['id'] as $k => $v) {
      $result = @mysql_query('SELECT id,author_ip FROM `'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'` WHERE id="'.$v.'" AND title_mark LIKE "[荐]%"'.$where_key.'', $db);
      if ($row = @mysql_fetch_assoc($result)) {
        @mysql_free_result($result);
        if (!strstr($row['author_ip'], '.')) {
          $arr_author[$row['author_ip']] = abs($arr_author[$row['author_ip']]) + 1;
          $arr_article[$row['author_ip']] .= '，'.$row['id'];
        }
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET title_mark=REPLACE(title_mark,"[荐]","") WHERE id="'.$v.'"', $db);
        unset($row);
      }
    }
/*
撤精减掉分，不必了吧
*/
    if (count($arr_author) > 0) {
      $step = 0;
      foreach ($arr_author as $username => $size) {
        if (is_numeric($_POST['credit_value']) && $_POST['credit_value'] > 0) {
          @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`,`other`) VALUES ("'.$username.'","1","文章推荐被取消","-'.($_POST['credit_value'] * $size).'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND),"文章ID：'.ltrim($arr_article[$username], '，').'")', $db);
          $step += 10;
        }
        if (is_numeric($_POST['funds_value']) && $_POST['funds_value'] > 0) {
          @mysql_query('INSERT INTO `'.$sql['pref'].''.$sql['data']['承载财务数据的表名'].'` (`username`,`type`,`description`,`money`,`date`,`other`) VALUES ("'.$username.'","0","文章推荐被取消","-'.($_POST['funds_value'] * $size).'",DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + $step).' SECOND),"文章ID：'.ltrim($arr_article[$username], '，').'")', $db);
          $step += 10;
        }
      }
    }

  //清除地区
  } elseif ($limit == 'ccity') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET city="" WHERE '.$id_key.''.$where_key.'', $db);

  //刷新
  } elseif ($limit == 'refresh') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET topdate=DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR) WHERE '.$id_key.' AND topdate<DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR)'.$where_key.'', $db);

  //置顶
  } elseif ($limit == 'top') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET topdate=DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.(floatval($web['time_pos']) * 3600 + abs($web['top_expires']) * 24 * 60 * 60).' SECOND) WHERE '.$id_key.''.$where_key.'', $db);

  //撤顶
  } elseif ($limit == 'ctop') {
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET topdate=IF(`other`="",`date`,DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR)) WHERE '.$id_key.' AND topdate>DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR)'.$where_key.'', $db);

  //审核不通过
  } elseif ($limit == 'check_warning') {
    if (!empty($_REQUEST['why'])) {
      $e = ',other="'.filter1($_REQUEST['why']).'"';
    }
    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET area_check="2"'.$e.' WHERE '.$id_key.''.$where_key.'', $db);
    //$hot_user = 1;
    if ($_REQUEST['m'] == 1) {
      err('<script> var obj=parent.$(\'check_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  //审核通过
  } elseif ($limit == 'check') {
    if ($_POST['checksendmess'] == 1) {
      $this_key2 = '"'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(\"".$date."|管理员|文章审核通过通知|<p>您好：<br />您\",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.date,\"发表的文章：</p><blockquote><b>\",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.title,\"</b></blockquote><p>在最近的审核中获得通过。<br />恭喜您，欢迎继续发表。</p>||| \n\",'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(ABS('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)+1,\"/\",SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))+1),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)"';
      $out .= '已向作者发送短信。';
    }
    $year = gmdate('Y', time() + (floatval($web['time_pos']) * 3600));
    $date = gmdate('md', time() + (floatval($web['time_pos']) * 3600));
    $step = 0;
    foreach ($_REQUEST['id'] as $k => $v) {
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].','.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' SET '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point='.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point+'.abs($web['writeadd']).','.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.writecount='.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.writecount+1 WHERE ('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_check<>"0") AND ('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.author_ip AND '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username NOT REGEXP "[\.]+")'.$where_key.'', $db);
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_check="0",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.other="" WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_check<>"0"'.$where_key.'', $db);
      //更新统计
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total='.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total+1,'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today=IF('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.date="'.$year.$date.'",(IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today,1,4)="'.$date.'",CONCAT("'.$date.'",SUBSTRING('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today,5)+1),"'.$date.'1")),'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today) WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_id=SUBSTRING_INDEX('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id,"_",1)', $db);

      $step += 10;
      $date = gmdate('YmdHis', time() + (floatval($web['time_pos']) * 3600) + $step);
      if (!empty($this_key2)) {
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.eval('return '.$this_key2.';').' WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND ('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.author_ip AND '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username NOT REGEXP "[\.]+")'.$where_key.'', $db);
      }
    }

    //$hot_user = 1;
    if ($_REQUEST['m'] == 1) {
      err('<script> var obj=parent.$(\'check_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  //删除——审核中
  } elseif ($limit == 'del_check') {
    if ($_POST['delsendmess'] == 1) {
      $this_key2 = '"'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(\"".$date."|管理员|文章删除通知|<p>您好：<br />您\",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.date,\"发表的文章：</p><blockquote><b>\",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.title,\"</b></blockquote><p>在最近的审核中没有通过，并被删除。<br />请您仔细阅读<a href=help.php#write_2 target=_blank>发表规则</a>，以便成功发布推广您的信息。</p>||| \n\",'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(ABS('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)+1,\"/\",SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))+1),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)"';
      $out .= '已向被删者发送短信。';
    }
    $step = 0;
    foreach ($_REQUEST['id'] as $k => $v) {
      //清理上传夹
      @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "info-'.$v.'-%" OR title LIKE "reply-'.$v.'_%" OR title LIKE "thumb-'.$v.'.%" OR title LIKE "thuml-'.$v.'.%"', $db);
      foreach ((array)@glob('__temp__/temp/{info-'.$v.'-,reply-'.$v.'_,thumb-'.$v.'.,thuml-'.$v.'.}*', GLOB_BRACE) as $f) @unlink($f);

      $step += 10;
      $date = gmdate('YmdHis', time() + (floatval($web['time_pos']) * 3600) + $step);
      if (!empty($this_key2)) {
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.eval('return '.$this_key2.';').' WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND ('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.author_ip AND '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username NOT REGEXP "[\.]+")'.$where_key.'', $db);
      }
      @mysql_query('DELETE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].','.$sql['pref'].''.$sql['data']['承载关键词的表名'].' FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' LEFT JOIN '.$sql['pref'].''.$sql['data']['承载关键词的表名'].' ON '.$sql['pref'].''.$sql['data']['承载关键词的表名'].'.id='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'"'.$where_key.'', $db);
    }

    if ($_GET['m'] == 1) {
      err('<script> var obj=parent.$(\'check_'.$_REQUEST['id'][0].'\'); var par=obj.parentNode; par.removeChild(obj); obj.style.display=\'none\'; </script>');
    }

  //删除
  } elseif ($limit == 'del') {
    //require ('inc/function/area_statistics.php');
    $this_key1 = $_POST['del_type_from'] != 'manager_check' ? ''.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point=IF('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point-'.abs($web['writeadd']).'>0,'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.point-'.abs($web['writeadd']).',0),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.writecount=IF('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.writecount-1>0,'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.writecount-1,0)' : '';
    if ($_POST['delsendmess'] == 1) {
      $this_key2 = '"'.($this_key1 ? ',' : '').''.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(\"".$date_."|管理员|文章删除通知|<p>您好：<br />您\",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.date,\"发表的文章：</p><blockquote><b>\",'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.title,\"</b></blockquote><p>在最近的复审中被删除。<br />请您仔细阅读<a href=help.php#write_2 target=_blank>发表规则</a>，以便成功发布推广您的信息。</p>||| \n\",'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num=IF(SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))<'.$web['mess_count'].',CONCAT(ABS('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)+1,\"/\",SUBSTRING('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,INSTR('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num,\"/\")+1,LENGTH('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num))+1),'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.mess_num)"';
      $out .= '已向被删者发送短信。';
    }
    $step = 0;
    $year = gmdate('Y', time() + (floatval($web['time_pos']) * 3600));
    $date = gmdate('md', time() + (floatval($web['time_pos']) * 3600));
    foreach ($_REQUEST['id'] as $k => $v) {
      //清理上传夹
      @mysql_query('DELETE FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "info-'.$v.'-%" OR title LIKE "reply-'.$v.'_%" OR title LIKE "thumb-'.$v.'.%" OR title LIKE "thuml-'.$v.'.%"', $db);
      foreach ((array)@glob('__temp__/temp/{info-'.$v.'-,reply-'.$v.'_,thumb-'.$v.'.,thuml-'.$v.'.}*', GLOB_BRACE) as $f) @unlink($f);

      $step += 10;
      $date_ = gmdate('YmdHis', time() + (floatval($web['time_pos']) * 3600) + $step);
      if (!empty($this_key1) || !empty($this_key2)) {
        //die($this_key1.$this_key2);
        @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.$this_key1.eval('return '.$this_key2.';').' WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND ('.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.author_ip AND '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'.username NOT REGEXP "[\.]+")'.$where_key.'', $db);
      }
      //更新统计
      @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].','.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total=IF('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total-1>0,'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_total-1,0),'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today=IF('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.date="'.$year.$date.'" AND SUBSTRING('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today,5)-1>0,CONCAT("'.$date.'",SUBSTRING('.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_today,5)-1),"'.$date.'0") WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'" AND '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'.area_id=SUBSTRING_INDEX('.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.area_id,"_",1)', $db);

      @mysql_query('DELETE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].','.$sql['pref'].''.$sql['data']['承载关键词的表名'].','.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' LEFT JOIN ('.$sql['pref'].''.$sql['data']['承载关键词的表名'].','.$sql['pref'].''.$sql['data']['承载回复评论的表名'].') ON '.$sql['pref'].''.$sql['data']['承载关键词的表名'].'.id='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.r_id='.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id WHERE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'.id="'.$v.'"'.$where_key.'', $db);
    }
    require ('inc/function/hot_mark.php');

  if (file_exists('get_newinfo_for162100_run.php')) {
    include ('get_newinfo_for162100_run.php');
  }


  //转移
  } elseif ($limit == 'chanto') {
    $result = @mysql_query('SELECT id FROM `'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'` WHERE area_id="'.$_POST['to_id'].'"', $db);
    if (!$row = @mysql_fetch_assoc($result)) {
      err('系统错误：标签参数不合法（找不到该类别或类别重复）。');
    }
    unset($row);
    @mysql_free_result($result);

    @mysql_query('UPDATE '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' SET area_id="'.$_POST['to_id'].'" WHERE '.$id_key.''.$where_key.'', $db);

  } else {
    err('命令错误！');
  }


} else {
  err('数据库名错误！');
}

$end = @mysql_affected_rows();
@mysql_close();

if ($end > 0) {

} else {
  $out .= '<span class="grayword">（程序执行不完全或不成功、或未做更改！）</span>';
}

alert('执行完毕。'.$out, $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : 'webmaster_central.php');




?>