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

47 lines
1.7KB

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