www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\common\news\ajaxpost.asp
<% Response.ContentType="text/html" Response.Expires = -9999 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-ctrol", "no-cache" NewAsp.ChkPostAgent() Dim ArticleID,sType,s,m,PJ_CookieName Dim goodnum,badnum,totalscore,maxwidth,goodwidth,badwidth,goodpercent,badpercent Sub main() ArticleID=NewAsp.ChkNumeric(Request("id")) sType=NewAsp.ChkNumeric(Request("t")) s=NewAsp.ChkNumeric(Request("s")) m=NewAsp.ChkNumeric(Request("m")) PJ_CookieName="News_PingJia_"&ChannelID&"_"&ArticleID If s=0 Then If ArticleID>0 Then Call PostAppraised() Else If ArticleID>0 Then Call LoadAppraised() End If End Sub Sub LoadAppraised() Dim Rs Set Rs = NewAsp.Execute("SELECT ArticleID,good,bad FROM NC_Article WHERE ArticleID="&ArticleID) If Rs.BOF And Rs.EOF Then Response.Write "" Else goodnum=CLng(Rs("good")) badnum=CLng(Rs("bad")) totalscore=goodnum+badnum If totalscore>0 Then goodpercent=FormatPercent(goodnum/totalscore,0,-1) badpercent=FormatPercent(badnum/totalscore,0,-1) Else goodpercent="0%" badpercent="0%" End If goodwidth=GetGoodWidth(m) badwidth=GetBadWidth(m) Response.Clear Response.Write ""&totalscore&","&goodnum&","&badnum&","&goodpercent&","&badpercent&","&goodwidth&","&badwidth&"" End If Set Rs = Nothing End Sub Sub PostAppraised() Dim Rs,SQL If Trim(Request.Cookies(PJ_CookieName)&"")="ok" Then Exit Sub Response.Cookies(PJ_CookieName).path = "/" Response.Cookies(PJ_CookieName).Expires = Date + 1 Response.Cookies(PJ_CookieName)="ok" If sType=0 Then NewAsp.Execute ("UPDATE NC_Article SET bad=bad+1 WHERE ArticleID="&ArticleID) Else NewAsp.Execute ("UPDATE NC_Article SET good=good+1 WHERE ArticleID="&ArticleID) End If Call LoadAppraised() End Sub Function GetGoodWidth(sVariant) Dim w sVariant=NewAsp.ChkNumeric(sVariant) If sVariant=0 Then sVariant=100 If totalscore>0 Then w=NewAsp.ChkNumeric(Fix((goodnum/totalscore)*sVariant)) Else w=1 End If If w<1 Then w=1 GetGoodWidth=w End Function Function GetBadWidth(sVariant) Dim w sVariant=NewAsp.ChkNumeric(sVariant) If sVariant=0 Then sVariant=100 If totalscore>0 Then w=NewAsp.ChkNumeric(Fix((badnum/totalscore)*sVariant)) Else w=1 End If If w<1 Then w=1 GetBadWidth=w End Function %>