国内流行的内容管理系统(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.

106 lines
3.6KB

  1. <?php
  2. /**
  3. * @version $Id: flink_main.php 1 8:38 2010年7月9日Z tianya $
  4. * @package DedeBIZ.Member
  5. * @copyright Copyright (c) 2020, DedeBIZ.COM
  6. * @license https://www.dedebiz.com/license
  7. * @link https://www.dedebiz.com
  8. */
  9. require_once(dirname(__FILE__) . "/config.php");
  10. CheckRank(0, 0);
  11. $menutype = 'config';
  12. if ($cfg_mb_lit == 'Y') {
  13. ShowMsg("由于系统开启了精简版会员空间,你访问的功能不可用!", "-1");
  14. exit();
  15. }
  16. if (empty($dopost)) $dopost = '';
  17. if ($dopost == "addnew") {
  18. AjaxHead();
  19. $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member_flink` WHERE mid='" . $cfg_ml->M_ID . "' ");
  20. if ($row['dd'] >= 50) {
  21. echo "<font color='red'>增加网址失败,因为已经达到五十个网址的上限!</font>";
  22. GetLinkList($dsql);
  23. exit();
  24. }
  25. if (!preg_match("#^http:\/\/#", $url)) $url = "http://" . HtmlReplace($url, 2);
  26. $title = HtmlReplace($title);
  27. $url = HtmlReplace($url);
  28. $inquery = "INSERT INTO `#@__member_flink`(mid,title,url) VALUES(" . $cfg_ml->M_ID . ",'$title','$url'); ";
  29. $dsql->ExecuteNoneQuery($inquery);
  30. echo "<font color='red'>成功增加一链接!</font>";
  31. GetLinkList($dsql);
  32. exit();
  33. } else if ($dopost == "del") {
  34. AjaxHead();
  35. $aid = intval($aid);
  36. if (empty($aid)) exit("<font color='red'>参数错误!</font>");
  37. $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_flink` WHERE aid='$aid' AND mid='" . $cfg_ml->M_ID . "';");
  38. echo "<font color='red'>成功删除链接:{$aid}</font>";
  39. GetLinkList($dsql);
  40. } else if ($dopost == "update") {
  41. AjaxHead();
  42. $aid = intval($aid);
  43. if (!preg_match("#^http:\/\/#", $url)) $url = "http://" . HtmlReplace($url, 2);
  44. $title = HtmlReplace($title);
  45. $url = HtmlReplace($url);
  46. $upquery = "UPDATE `#@__member_flink` SET title='$title',url='$url' WHERE aid='$aid' AND mid='" . $cfg_ml->M_ID . "'; ";
  47. $rs = $dsql->ExecuteNoneQuery($upquery);
  48. if ($rs) {
  49. echo "<font color='red'>成功更新链接:{$title}</font>";
  50. GetLinkList($dsql);
  51. exit();
  52. } else {
  53. echo "<font color='red'>更新链接:{$title} 失败!</font>";
  54. GetLinkList($dsql);
  55. exit();
  56. }
  57. } else if ($dopost == "reload") {
  58. AjaxHead();
  59. GetLinkList($dsql);
  60. exit();
  61. }
  62. //默认界面
  63. else {
  64. require_once(dirname(__FILE__) . "/templets/flink_main.htm");
  65. exit();
  66. }
  67. /**
  68. * 获取链接列表
  69. *
  70. * @access public
  71. * @param object $dsql 数据库操作类
  72. * @return string
  73. */
  74. function GetLinkList(&$dsql)
  75. {
  76. global $cfg_ml;
  77. $dsql->SetQuery("SELECT * FROM `#@__member_flink` WHERE mid='" . $cfg_ml->M_ID . "' ORDER BY aid DESC");
  78. $dsql->Execute();
  79. $j = 0;
  80. while ($row = $dsql->GetArray()) {
  81. $j++;
  82. $line = "
  83. <div class='item flink'>
  84. <div class='itemHead' >
  85. <div class='fRight'>
  86. <span class='itemDigg'><a href='#' onclick='UpdateType({$row['aid']})'>[更新]</a></span>
  87. <span class='itemManage'><a href='#' onclick='DelType({$row['aid']})'>[删除]</a></span>
  88. </div>
  89. <span class='itemTitle'>名称:<input name='title{$row['aid']}' type='text' id='title{$row['aid']}' value='{$row['title']}' class='intxt' /></span>
  90. <div class='mt5'>网址:<input name='url{$row['aid']}' type='text' id='url{$row['aid']}' value='{$row['url']}' class='intxt' /></div>
  91. </div>
  92. </div>
  93. <hr class='dotted' />";
  94. echo $line;
  95. }
  96. if ($j == 0) {
  97. echo "尚无任何链接";
  98. }
  99. }