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

50 lines
1.9KB

  1. <?php
  2. /**
  3. * 收藏
  4. *
  5. * @version $Id: stow.php$
  6. * @package DedeBIZ.Site
  7. * @copyright Copyright (c) 2022, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/../system/common.inc.php");
  12. $aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
  13. $type = empty($type) ? "" : HtmlReplace($type, 1);
  14. if ($aid == 0) {
  15. ShowMsg('文档id不能为空', 'javascript:window.close();');
  16. exit();
  17. }
  18. require_once(DEDEINC."/memberlogin.class.php");
  19. $ml = new MemberLogin();
  20. if ($ml->M_ID == 0) {
  21. ShowMsg('只有会员才允许收藏操作', 'javascript:window.close();');
  22. exit();
  23. }
  24. //读取文档信息
  25. $arcRow = GetOneArchive($aid);
  26. if ($arcRow['aid'] == '') {
  27. ShowMsg("无法收藏未知文档", "javascript:window.close();");
  28. exit();
  29. }
  30. extract($arcRow, EXTR_SKIP);
  31. $title = HtmlReplace($title, 1);
  32. $aid = intval($aid);
  33. $addtime = time();
  34. if ($type == '') {
  35. $row = $dsql->GetOne("SELECT * FROM `#@__member_stow` WHERE aid='$aid' And mid='{$ml->M_ID}' AND type IS NULL ");
  36. if (!is_array($row)) {
  37. $dsql->ExecuteNoneQuery("INSERT INTO `#@__member_stow`(mid,aid,title,addtime) VALUES ('".$ml->M_ID."','$aid','".addslashes($arctitle)."','$addtime'); ");
  38. }
  39. } else {
  40. $row = $dsql->GetOne("SELECT * FROM `#@__member_stow` WHERE type='$type' AND (aid='$aid' AND mid='{$ml->M_ID}')");
  41. if (!is_array($row)) {
  42. $dsql->ExecuteNoneQuery("INSERT INTO `#@__member_stow`(mid,aid,title,addtime,type) VALUES ('".$ml->M_ID."','$aid','$title','$addtime','$type'); ");
  43. }
  44. }
  45. //更新用户统计
  46. $row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM `#@__member_stow` WHERE `mid`='{$ml->M_ID}' ");
  47. $dsql->ExecuteNoneQuery("UPDATE `#@__member_tj` SET `stow`='{$row['nums']}' WHERE `mid`='".$ml->M_ID."'");
  48. ShowMsg('成功收藏一篇文档', 'javascript:window.close();');