国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
4.5KB

  1. <?php
  2. /**
  3. * 搜索关键词管理
  4. *
  5. * @version $id:search_keywords_main.php 15:46 2010年7月20日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (https://www.dedebiz.com/license)
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
  13. if (empty($pagesize)) $pagesize = 30;
  14. if (empty($pageno)) $pageno = 1;
  15. if (empty($dopost)) $dopost = '';
  16. if (empty($orderby)) $orderby = 'aid';
  17. $orderby = HtmlReplace($orderby, -1);
  18. $pageno = intval($pageno);
  19. $pagesize = intval($pagesize);
  20. //重载列表
  21. if ($dopost == 'getlist') {
  22. AjaxHead();
  23. GetKeywordList($dsql, $pageno, $pagesize, $orderby);
  24. exit();
  25. }
  26. //更新字段
  27. else if ($dopost == 'update') {
  28. $aid = preg_replace("#[^0-9]#", "", $aid);
  29. $count = preg_replace("#[^0-9]#", "", $count);
  30. $keyword = trim($keyword);
  31. $spwords = trim($spwords);
  32. $dsql->ExecuteNoneQuery("UPDATE `#@__search_keywords` SET keyword='$keyword',spwords='$spwords',count='$count' WHERE aid='$aid';");
  33. AjaxHead();
  34. GetKeywordList($dsql, $pageno, $pagesize, $orderby);
  35. exit();
  36. }
  37. //删除字段
  38. else if ($dopost == 'del') {
  39. $aid = preg_replace("#[^0-9]#", "", $aid);
  40. $dsql->ExecuteNoneQuery("DELETE FROM `#@__search_keywords` WHERE aid='$aid';");
  41. AjaxHead();
  42. GetKeywordList($dsql, $pageno, $pagesize, $orderby);
  43. exit();
  44. }
  45. //批量删除字段
  46. else if ($dopost == 'delall') {
  47. foreach ($aids as $aid) {
  48. $dsql->ExecuteNoneQuery("DELETE FROM `#@__search_keywords` WHERE aid='$aid';");
  49. }
  50. ShowMsg("删除成功", $ENV_GOBACK_URL);
  51. exit();
  52. }
  53. //第一次进入这个页面
  54. if ($dopost == '') {
  55. $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__search_keywords`");
  56. $totalRow = $row['dd'];
  57. include(DEDEADMIN."/templets/search_keywords_main.htm");
  58. }
  59. //获得特定的关键词列表
  60. function GetKeywordList($dsql, $pageno, $pagesize, $orderby = 'aid')
  61. {
  62. global $cfg_phpurl;
  63. $start = ($pageno - 1) * $pagesize;
  64. $printhead = "<form name='form3' action=\"search_keywords_main.php\" method=\"post\">
  65. <input name=\"dopost\" type=\"hidden\" value=\"\">
  66. <table class='table border my-3'>
  67. <tr>
  68. <td colspan='8'>搜索关键词维护</td>
  69. </tr>
  70. <tr align='center'>
  71. <td width='6%'>选择</td>
  72. <td width='6%'><a href=\"javascript:ReloadPage('aid');\">id</a></td>
  73. <td width='20%'>关键词</td>
  74. <td width='20%'>分词结果</td>
  75. <td width='6%'><a href=\"javascript:ReloadPage('count');\">频率</a></td>
  76. <td width='6%'><a href=\"javascript:ReloadPage('result');\">结果</a></td>
  77. <td width='12%'><a href=\"javascript:ReloadPage('lasttime');\">搜索时间</a></td>
  78. <td>操作</td>
  79. </tr>";
  80. echo $printhead;
  81. if ($orderby == 'result') $orderby = $orderby." ASC";
  82. else $orderby = $orderby." DESC";
  83. $dsql->SetQuery("SELECT * FROM `#@__search_keywords` ORDER BY $orderby LIMIT $start,$pagesize ");
  84. $dsql->Execute();
  85. while ($row = $dsql->GetArray()) {
  86. $line = "<tr align='center'>
  87. <td><input name=\"aids[]\" type=\"checkbox\" value=\"{$row['aid']}\"></td>
  88. <td>{$row['aid']}</td>
  89. <td><input type='text' name='keyword' id='keyword{$row['aid']}' value='{$row['keyword']}' class='admin-input-md'></td>
  90. <td><input type='text' name='spwords' id='spwords{$row['aid']}' value='{$row['spwords']}' class='admin-input-md'></td>
  91. <td><input type='text' name='count' id='count{$row['aid']}' value='{$row['count']}' class='admin-input-sm'></td>
  92. <td><a href='{$cfg_phpurl}/search.php?kwtype=0&keyword=".urlencode($row['keyword'])."&searchtype=titlekeyword' target='_blank'>{$row['result']}</a></td>
  93. <td><span>".MyDate("Y-m-d H:i:s", $row['lasttime'])."</span></td>
  94. <td>
  95. <a href='javascript:UpdateNote({$row['aid']});' class='btn btn-light btn-sm'><i class='fa fa-repeat'></i> 更新</a>
  96. <a href='javascript:DelNote({$row['aid']});' class='btn btn-danger btn-sm'><i class='fa fa-trash'></i> 删除</a>
  97. </td>
  98. </tr>";
  99. echo $line;
  100. }
  101. echo "<tr>
  102. <td colspan='8'>
  103. <a href=\"javascript:selAll();\" class='btn btn-success btn-sm'>反选</a>
  104. <a href=\"javascript:noselAll();\" class='btn btn-success btn-sm'>取消</a>
  105. <a href=\"javascript:delall();\" class='btn btn-danger btn-sm'>删除</a>
  106. </td>
  107. </tr>";
  108. echo "</table></form>";
  109. }