<!--#include file="../../inc/conn.asp" -->
<%
dim action,d_vid,d_type
action = be("get", "action")
d_vid = be("get", "d_vid")
d_type = be("get", "d_type")
If Not isNum(d_vid) Then writeE "非法访问"
If Not isNum(d_type) Then writeE "非法访问"

Select Case action
	Case "show": show
	Case "digg": digg
	Case Else: main
End Select
dispseObj()

Sub show()
	Dim good, bad, goodall, digsper, undigsper, str, rs
	Set rs = objdb.DB("SELECT * FROM {pre}vod WHERE d_id=" & d_vid, "rs1")
	If Not (rs.EOF And rs.Bof) Then
		good = rs("d_good"): bad = rs("d_bad")
	End If
	goodall = good + bad
	If goodall = 0 Then
		digsper = 0
		undigsper = 0
	Else
		digsper = FormatNumber(CInt(good) / CInt(goodall), 3) * 100
		undigsper = FormatNumber(CInt(bad) / CInt(goodall), 3) * 100
	End If
        
	str = "<div class='good'>"
	str = str & "<a href=JavaScript:isdigs('d_good') >"
	str = str & "<p>Good</p><div class='bar'><div id='g_img' style='width:" & digsper & "%'></div></div>"
	str = str & "<span class='num'>" & digsper & "%(" & good & ")</span>"
	str = str & "</a></div><div class='bad'>"
	str = str & "<a href=JavaScript:isdigs('d_bad') >"
	str = str & "<p>Bad</p><div class='bar'><div id='b_img' style='width:" & undigsper & "%'></div></div>"
	str = str & "<span class='num'>" & undigsper & "%(" & bad & ")</span>"
	str = str & "</a></div>"
	writeA str
End Sub

Sub digg()
	Dim typee: typee = be("get", "typee")
	If isN(typee) Then writeA "非法访问": Exit Sub
	If getCookie("voddigg_" & d_vid) = "ok" Then writeA "1": Exit Sub
	objdb.DB "Update {pre}vod set " & typee & "=" & typee & "+1 where d_id=" & d_vid, "exe"
	setCookie "voddigg_" & d_vid, "ok"
End Sub
    
Sub main()
	Dim str
	str = "var d_vid=""" & d_vid & """;"
	str = str & "var d_type=""" & d_type & """;"
	str = str & "showdigg();"
	writeA str
End Sub
%>