<!--#include file="conn.asp"--><%seo_title="My favorites-"&sitename%>
<!--#include file="IncAsp/WrzcNet_top.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/WrzcNet_log.asp"--><div class="d5"></div>
</td>
<td valign="top" class="all_c_td">

<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="sort">&nbsp;<IMG src="Skin/<%=WrzcNet_skin%>/home.gif" border=0 align="absmiddle">  <a href="index.asp">Home</a> >>&nbsp;My favorites</td></tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="useri">
<tr><td height="150" valign=top>
<%if Request.Cookies("WrzcNet")("user_name")="" then
response.redirect "login.asp?comurl=fav.asp"
response.end
else
username=Request.Cookies("WrzcNet")("user_name")
chklogin(user_name)
if request("action")="add" then
hw_id=request("hw_id")
chkid hw_id
set rs=server.CreateObject("adodb.recordset")
sql="select user_fav from WrzcNet_user where username='"&username&"' order by id desc"
rs.open sql,conn,1,3
if rs.eof then
showerr "e"
end if
user_fav=rs("user_fav")
if isnull(user_fav) or instr(user_fav,"/")=0 then
rs("user_fav")="/"&trim(hw_id)
rs.update
rs.close
set rs=nothing
Response.Write "<script language=javascript>window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
else
comid=split(user_fav,"/")
for i=1 to ubound(comid)
if trim(hw_id)=trim(comid(i)) then
showerr "e5"
end if
next
rs("user_fav")=rs("user_fav")&"/"&trim(hw_id)
rs.update
rs.close
set rs=nothing
Response.Write "<script language=javascript>window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
end if
end if
if request("action")="del" then
hw_id=request("hw_id")
chkid hw_id
set rs=server.CreateObject("adodb.recordset")
rs.open "select user_fav from WrzcNet_user where username='"&username&"'",conn,1,3
if rs.eof then
showerr "e"
end if
user_fav=trim(rs("user_fav"))
if isnull(user_fav) or instr(user_fav,"/")=0 then
rs("user_fav")=""
rs.update
rs.close
set rs=nothing
Response.Write "<script language=javascript>window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
end if
comid=split(trim(user_fav),"/")
for i=1 to ubound(comid)
if trim(hw_id)<>trim(comid(i)) then
comn=comn&"/"&trim(comid(i))
end if
next
rs("user_fav")=trim(comn)
rs.update
rs.close
set rs=nothing
Response.Write"<script language=javascript>window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
end if
if request("action")="delall" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select user_fav from WrzcNet_user where username='"&username&"'",conn,1,3
if rs.eof then
showerr "e"
end if
rs("user_fav")=""
rs.update
rs.close
set rs=nothing
Response.Write"<script language=javascript>window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
end if
set rsu=server.CreateObject("adodb.recordset")
user_name=Request.Cookies("WrzcNet")("user_name")
sql="select * from WrzcNet_user where username='"&user_name&"'"
rsu.open sql,conn,1,1
if rsu.eof then
response.redirect "login.asp?comurl=fav.asp"
response.end
else
user_fav=trim(rsu("user_fav"))
end if
rsu.close
set rsu=nothing
if isnull(user_fav) or instr(user_fav,"/")=0 then%>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center" height="100">No Data</td></tr></table>
<%else
favid=split(trim(user_fav),"/")%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td align="right" height="30"><p style="margin:5px; "><%=ubound(favid)%> products 
	[<a href="fav.asp?action=delall">Delete all</a>]:</td></tr>
<tr><td valign="top"></td></tr></table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="cartshowa">product</td>
<td align="center" class="cartshowa">Price</td>
<td align="center" class="cartshowa">Add to cart</td>
<td align="center" class="cartshowa">Delete</td></tr>
<%for i=1 to ubound(favid)
hw_id=trim(favid(i))
if hw_id<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from WrzcNet_hw where hw_id="&hw_id&"",conn,1,1
if not rs.eof then%>
<tr class="cartshow<%=(i mod 2)%>"><td><a target="_blank" href="views.asp?hw_id=<%=rs("hw_id")%>" class="r"><%=rs("hw_name")%></a></td>
<td align="center"><%=fuhao%><%=rs("hw_price2")*hui%></td>
<td align="center"><a href="basket.asp?hw_id=<%=rs("hw_id")%>">Add to cart</a></td>
<td align="center"><a href="fav.asp?action=del&hw_id=<%=rs("hw_id")%>">Delete</a></td></tr>
<%else%>
<tr class="cartshow<%=(i mod 2)%>"><td colspan="4">Product Sold Out! <a href="fav.asp?action=del&hw_id=<%=hw_id%>">Delete</a></td></tr>
<%end if
rs.close
set rs=nothing
end if
next%>
</table>
<%end if
end if%>
</td></tr></table>

</td></tr></table></div><!--#include file="IncAsp/WrzcNet_copy.asp"-->