Hjælp til gammel ASP kode
HejJeg har noget kode som jeg gerne vil have noget hjælp til:
<% if(session("login")="") then response.redirect "default.asp"%>
<!--#include virtual="/inc/inc.default.asp"-->
<%
set db=db_open
set rs=db.execute("SELECT * FROM settings WHERE id=0")
recipient=rs("email")
url_order=rs("url_order")
cancelorder=rs("cancelorder")
cancelorder_en=rs("cancelorder_en")
rs.close
set rs=nothing
email=request("e-mail")
set rs=db.execute("SELECT book.*, hotel.hotel as hotel_name,hotel.phone as hotel_phone,hotel.fax as hotel_fax,hotel.email as hotel_email FROM book Inner Join hotel ON book.hotel=hotel.id WHERE book.id='"&request("bid")&"'")
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
if(session("order_language")="en") then
set f=fs.OpenTextFile(server.MapPath("\")&"\email_en.htm",1,true)
else
set f=fs.OpenTextFile(server.MapPath("\")&"\email.htm",1,true)
end if
sTmp=f.readall
f.Close
set f=nothing
set fs=nothing
mArr=array("","Januar","Februar","Marts","April","Maj","Juni","Juli","August","September","Oktober","November","December")
d=day(rs("day"))
if(len(d)=1) then
d="0" & d
end if
dt=d&" "&mArr(month(rs("day")))&" "&year(rs("day"))
if(rs("confirm")=1) then
morethan16=0
subject="xxx online - " & dt
if(session("order_language")="en") then
text="This order confirmation must be brought and handed to the waiter at the table.<br>Payment for xxx Dinnershow, drinks, and possible additional menu fees, will be made at the show."
program=session("program_uk")
else
text="Denne bekræftelse skal medbringes på aftenen og afleveres til tjeneren ved bordet.<br>Afregning for xxx Dinnershow samt drikkevarer og evt. menutillæg foretages på aftenen."
program=session("program_dk")
end if
else
morethan16=1
subject="Forespørgsel - xxx online - " & dt
if(session("order_language")="en") then
text="<span style=""font-weight:bold;color:blue"">We have received your inquiery and will send an e-mail confirmation to you, as soon as possible.</span>"
cancelorder=cancelorder_en
program=session("program_uk")
else
text="<span style=""font-weight:bold;color:blue"">Vi har modtaget din forespørgsel og vil vende tilbage hurtigst muligt med en bekræftelse pr. mail.</span>"
program=session("program_dk")
end if
end if
sTmp=replace(sTmp,"<!--#date-->",dt)
sTmp=replace(sTmp,"<!--#hotelemail-->",rs("hotel_email"))
sTmp=replace(sTmp,"<!--#hotel-->",rs("hotel_name"))
sTmp=replace(sTmp,"<!--#hotelphone-->",rs("hotel_phone"))
sTmp=replace(sTmp,"<!--#hotelfax-->",rs("hotel_fax"))
sTmp=replace(sTmp,"<!--#book_name-->",rs("book_name"))
if(rs("hotel_package")) then
if(session("order_language")="en") then
sTmp=replace(sTmp,"<!--#hotel_package-->","Yes")
else
sTmp=replace(sTmp,"<!--#hotel_package-->","Ja")
end if
else
if(session("order_language")="en") then
sTmp=replace(sTmp,"<!--#hotel_package-->","No")
else
sTmp=replace(sTmp,"<!--#hotel_package-->","Nej")
end if
end if
on error resume next
sTmp=replace(sTmp,"<!--#guest_name-->",rs("guest"))
sTmp=replace(sTmp,"<!--#guest_email-->",rs("guest_email"))
sTmp=replace(sTmp,"<!--#guest_phone-->",rs("guest_phone"))
sTmp=replace(sTmp,"<!--#number-->",rs("number"))
sTmp=replace(sTmp,"<!--#comment-->",rs("comment"))
sTmp=replace(sTmp,"<!--#menu-->",rs("menu"))
sTmp=replace(sTmp,"<!--#allergy-->",rs("allergy"))
sTmp=replace(sTmp,"<!--#drinks-->",rs("drinks"))
sTmp=replace(sTmp,"<!--#url_order-->",url_order)
sTmp=replace(sTmp,"<!--#text-->",text)
sTmp=replace(sTmp,"<!--#program-->",program)
if(rs("kategoriA")) then
sTmp=replace(sTmp,"<!--#kategori-->","A")
else
sTmp=replace(sTmp,"<!--#kategori-->","B")
end if
if(rs("number")<=16) then
sTmp=replace(sTmp,"<!--#cancelorder-->",cancelorder)
end if
on error goto 0
if(session("order_language")="en") then
response.write replace(sTmp,"<!--#price-->","<th align=""left"">Price per guest</th><td>"&rs("price")&"</td></tr>")
else
response.write replace(sTmp,"<!--#price-->","<th align=""left"">Pris pr. gæst</th><td>"&rs("price")&"</td></tr>")
end if
rs.close
set rs=nothing
db.close
set db=nothing
%>
Det er dette stykke der volder mig problemer:
if(session("order_language")="en") then
response.write replace(sTmp,"<!--#price-->","<th align=""left"">Price per guest</th><td>"&rs("price")&"</td></tr>")
else
response.write replace(sTmp,"<!--#price-->","<th align=""left"">Pris pr. gæst</th><td>"&rs("price")&"</td></tr>")
end if
Jeg vil gerne have hvis "hotel_package" er = nej så skal den IKKE outputte noget. Det store spørgsmål er hvordan jeg får det inkluderet i ovenstående kode?