<%dbs="../"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
''''评论综合系统
if session("Uid")="" or session("ucuser")="" Then
ucuser=request.form("ucuser")
ucpass=request.form("ucpass")
if ucuser="" then
response.Write "<script >alert('提示：\n\n对不起，用户名不能为空,请填写用户名...');history.back(-1);</script>"
response.end
end if
if ucpass="" then
response.Write "<script >alert('提示：\n\n对不起，密码不能为空,请填写密码...');history.back(-1);</script>"
response.end
end if
mi=md5(ucpass)
'''''''开始查询
set rs=server.createobject("adodb.recordset")
	sql="select * from H_user where ucuser='"&ucuser&"' and ucpass='"&mi&"'"
	rs.open sql,conn,1,1
 	if not(rs.bof and rs.eof) then
			session("Uid") = rs("id")
			session("ucuser") = rs("ucuser")
	else
			response.Write "<script >alert('提示：\n\n对不起，用户名或密码错误...\n\n请注册后登陆评论');history.back(-1);</script>"
			response.end
	end if
end if
Purl=request.QueryString("Purl")
UID=Replace(Replace(Left(request.QueryString("UID"),9),"<","["),">","]")'收评人,商家或者ID
YID=session("Uid")'评论人
H_Services=Replace(Replace(Left(request.Form("H_Services"),3),"<","["),">","]")
H_setting=Replace(Replace(Left(request.Form("H_setting"),3),"<","["),">","]")
H_ce=Replace(Replace(Left(request.Form("H_ce"),3),"<","["),">","]")
H_Costs=Replace(Replace(Left(request.Form("H_Costs"),50),"<","["),">","]")
H_txt=Replace(Replace(Left(request.Form("H_txt"),300),"<","["),">","]")
H_OK=Replace(Replace(Left(request.Form("H_OK"),50),"<","["),">","]")
H_Traffic=Replace(Replace(Left(request.Form("H_Traffic"),50),"<","["),">","]")
if  UID="" or YID="" then
response.Write "系统错误"
end if
sql="select * from H_user  where ID="&UID&""
set rs=server.createobject("adodb.recordset")                     
rs.open sql,conn,1,1 
if rs.eof then
response.Write "非法操作"
end if
if H_Services="" or  IsNumeric(H_Services)<>true then
			response.Write "<script >alert('提示：\n\n对不起，请选择服务');history.back(-1);</script>"
			response.end
end if
if H_setting="" or  IsNumeric(H_setting)<>true then
			response.Write "<script >alert('提示：\n\n对不起，请选择环境');history.back(-1);</script>"
			response.end
end if
if H_ce="" or  IsNumeric(H_ce)<>true then
			response.Write "<script >alert('提示：\n\n对不起，请选择性价比');history.back(-1);</script>"
			response.end
end if
if H_txt="" then
			response.Write "<script >alert('提示：\n\n对不起，请填写评论');history.back(-1);</script>"
			response.end
end if
set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_Score"
	rs.open sql,conn,1,3
	rs.addnew
	rs("YID")=YID
	rs("UID")=UID
	rs("H_Services")=H_Services
	rs("H_setting")=H_setting
	rs("H_ce")=H_ce
	rs("H_OK")=H_OK
	rs("H_TXT")=H_TXT
	rs("H_Costs")=H_Costs
	rs("H_Traffic")=H_Traffic
	rs("Rdate")=now()
	rs.update
	rs.close
	set rs=nothing	
	'开始处理商店评价系统开始读取原始数据
	set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_page where UID="&UID&""
	rs.open sql,conn,1,1
	H_Services_old=rs("H_Services")
	H_setting_old=rs("H_setting")
	H_ce_old=rs("H_ce")
	rs.close	
	'开始写入
	set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_page where UID="&UID&""
	rs.open sql,conn,1,3  
	rs("H_Services")=H_Services_old+H_Services
	rs("H_setting")=H_setting_old+H_setting
	rs("H_ce")=H_ce_old+H_ce
	rs.update
	rs.close
	set rs=nothing	
	'系统开始发送短信
	if H_Services= 6 or  H_Services > 6 then
	H_Services_gov= "<img src=../images/span1.gif /> "
	elseif H_Services= 5 then
	H_Services_gov="<img src=../images/span2.gif /> "
	elseif H_Services= 4 then
	H_Services_gov= "<img src=../images/span3.gif /> "
	elseif H_Services= 3 then
	H_Services_gov= "<img src=../images/span4.gif />"
	elseif H_Services= 2 then
	H_Services_gov= "<img src=../images/span5.gif /> "
	else
	H_Services_gov= "<img src=../images/span6.gif />"
	end if
	
		if H_setting= 6 or  H_setting > 6 then
	H_setting_gov= "<img src=../images/span1.gif /> "
	elseif H_setting= 5 then
	H_setting_gov="<img src=../images/span2.gif /> "
	elseif H_Services= 4 then
	H_setting_gov= "<img src=../images/span3.gif /> "
	elseif H_Services= 3 then
	H_setting_gov= "<img src=../images/span4.gif />"
	elseif H_Services= 2 then
	H_setting_gov= "<img src=../images/span5.gif /> "
	else
	H_setting_gov= "<img src=../images/span6.gif />"
	end if
	
	if H_ce= 6 or  H_ce > 6 then
	H_ce_gov= "<img src=../images/span1.gif /> "
	elseif H_ce= 5 then
	H_ce_gov="<img src=../images/span2.gif /> "
	elseif H_ce= 4 then
	H_ce_gov= "<img src=../images/span3.gif /> "
	elseif H_ce= 3 then
	H_ce_gov= "<img src=../images/span4.gif />"
	elseif H_ce= 2 then
	H_ce_gov= "<img src=../images/span5.gif /> "
	else
	H_ce_gov= "<img src=../images/span6.gif />"
	end if
		set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_Message"
	rs.open sql,conn,1,3
	rs.addnew
	rs("UID")=YID'发送人ID
	rs("YID")=UID'收件人ID
	rs("Mtitle")=session("ucuser")&"对你进行了评论"'标题
	rs("Mchar")="<br><br> 服务："&H_Services_gov&"   环境："&H_setting_gov&"  性价比："&H_ce_gov&"<br><br>"&H_TXT&"<br><br>"  '内容
	rs("Mdu")=0'邮件未读状态
	rs("Rdate")=now()
	rs.update
	rs.close
	set rs=nothing	
	response.Write "<script >alert('提示：\n\n评论成功,立即返回...');location.href='../"&Purl&"';</script>"
	response.End()
%>
