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

58 lines
2.0KB

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