count.aspx.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*******************************************************************************
  2. * iNethinkCMS - 网站内容管理系统
  3. * Copyright (C) 2012-2013 inethink.com
  4. *
  5. * @author jackyang <69991000@qq.com>
  6. * @website http://cms.inethink.com
  7. * @version 1.3.6.0 (2013-08-14)
  8. *
  9. * This is licensed under the GNU LGPL, version 3.0 or later.
  10. * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
  11. *******************************************************************************/
  12. using System;
  13. using System.Data.SqlClient;
  14. using System.Collections.Generic;
  15. using System.Web;
  16. using System.Web.UI;
  17. using System.Web.UI.WebControls;
  18. using iNethinkCMS.Helper;
  19. namespace iNethinkCMS.Web.plugs.count
  20. {
  21. public partial class count : System.Web.UI.Page
  22. {
  23. protected void Page_Load(object sender, EventArgs e)
  24. {
  25. string rID;
  26. rID = Request.QueryString["ID"];
  27. rID = iNethinkCMS.Command.Command_Validate.SqlTextClear(rID);
  28. if (rID != null && Command.Command_Validate.IsNumber(rID) == true)
  29. {
  30. string vXmlPath = Server.MapPath(@"/plugs/count/setting.xml");
  31. int vID = Convert.ToInt32(rID);
  32. int vState = Convert.ToInt32(XMLHelper.GetXmlAttribute(vXmlPath, "//plugs//config//key[@name=\"state\"]", "value").Value.Trim());
  33. int vShow = Convert.ToInt32(XMLHelper.GetXmlAttribute(vXmlPath, "//plugs//config//key[@name=\"show\"]", "value").Value.Trim());
  34. if (vState == 0)
  35. {
  36. Response.End();
  37. }
  38. iNethinkCMS.Helper.SQLHelper.ExecuteSql("Update [iNethinkCMS_Content] Set [Views] = [Views] + 1 Where [ID] = " + vID);
  39. if (vShow == 1)
  40. {
  41. BLL.BLL_iNethinkCMS_Content bll = new BLL.BLL_iNethinkCMS_Content();
  42. Model.Model_iNethinkCMS_Content model = new Model.Model_iNethinkCMS_Content();
  43. model = bll.GetModel(vID);
  44. if (model != null)
  45. {
  46. Response.Write("document.write(" + model.Views + ")");
  47. }
  48. }
  49. }
  50. }
  51. }
  52. }