Salad UN

To Taste The Salad Of Life.

« DedeCMS SQL标签调用推荐企业与最新加入企业对Z-Blog进行SEO »

KingCMS使用MSSQL评论和Digg出现错误修改

[ At 2008-12-4 By Ash   3 comments ]

使用mssql时,评论系统出错的问题,这个问题是我老早就解决了,一直没贴解决办法。原因是sql系统的一个问题,这个只有使用mssql数据库的有(使用access的是没有问题的,请不要使用下面的代码)。
解决办法:
找到\page\comment目录下的fun.asp,在253行,可以搜索“public sub log(l1)'评论日志”找到,把这个函数替换为下面的这个就行了。

public sub log(l1)'评论日志
        if len(l1)>0 then
                conn.execute("set IDENTITY_INSERT kingcomment_log on" 
                if conn.execute("select count(*) from kingcomment_log where ip="&kc.ip&";"(0)>0 then
                        conn.execute "update kingcomment_log set kcontent='"&safe(left(l1,50))&"',kdate='"&tnow&"' where ip="&kc.ip&";"
                else
                        conn.execute "insert into kingcomment_log (ip,kcontent,kdate) values ("&kc.ip&",'"&safe(left(l1,50))&"','"&tnow&"')"
                end if
        else
                if conn.execute("select count(*) from kingcomment_log where ip="&kc.ip&";"(0)>0 then
                        conn.execute "update kingcomment_log set kdate='"&tnow&"' where ip="&kc.ip&";"
                else
                        conn.execute "insert into kingcomment_log (ip,kdate) values ("&kc.ip&",'"&tnow&"')"
                end if
                conn.execute("set IDENTITY_INSERT kingcomment_log off"
        end if
end sub

 

需要说明的是如果使用了Digg那么也会有同样的问题,只是表名不一样 评论的是kingcomment_log  Digg的是Kingdigg_log,代码也在差不多的位置,

'  *** Copyright &copy KingCMS.com All Rights Reserved ***
public sub log()
 conn.execute("set IDENTITY_INSERT kingdigg_log on") 
 if conn.execute("select count(*) from kingdigg_log where ip="&kc.ip&";")(0)>0 then
 
  conn.execute "update kingdigg_log set kdate='"&tnow&"' where ip="&kc.ip&";"
 else
 conn.execute "insert into kingdigg_log (ip,kdate) values ("&kc.ip&",'"&tnow&"')"
 end if
 conn.execute("set IDENTITY_INSERT kingdigg_log off")
end sub

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80722 Code detection by Codefense

Copyright 2008 www.s-un.cn. Some Rights Reserved.