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

119 lines
3.5KB

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