Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

anyone fancing code clean up?

Status
Not open for further replies.

gsc123

Programmer
Jan 24, 2008
197
0
0
I'm going mad looking at this can anyone tidy it up please?

<%if Request.QueryString("frst") = "1" then%>
<%Session("highbidder") = false%>
<form method="post" action="pt_showcart.asp?processbid=1" name="recalculate"> <!-- first step is here confirm bid-->
<%elseif Session("highbidder") = false then%>
<form method="post" action="pt_showcart.asp?updatebid=<%=Session("pPrice")%>&check=chkb&processbid=1" name="updatebid"> <!-- second step is here confirms your bid-->
<%end if%>
<%if Request.QueryString("processbid") = "1" and Request.QueryString("check") = "chkb" then

if Request.QueryString("rddib") = 2 then ' retry the bid by incrementing
%>
<font face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_20")%></font><img src="images/losing.jpg"></p>
<%
Session("pPrice") = Session("pPrice") + 10
end if

sql = "SELECT TOP 1 bidhistory.bidAmount AS price FROM bidhistory WHERE (((bidhistory.idProduct)="&Session("pIdProduct")&") AND ((bidhistory.idCustomerBid) <> "&session("idcustomer")&")) ORDER BY bidhistory.bidAmount DESC "
set rsMax = conntemp.execute(sql)
pPriceMax = rsMax("price")

Response.Write "Bid history price is "&pPriceMax
if CInt(pPriceMax) > CInt(Session("pPrice")) then
'Response.Write sql
Session("highbidder") = false
'update bid even if not high enough
mySQL="INSERT INTO bidhistory ( idCustomerBid, idProduct, bidAmount, bidDate ) values ("&session("idcustomer")&","&Session("pIdProduct")&","&Session("pPrice")&",'"&now()&"')"
'Response.Write mySQL
'conntemp.execute(mySQL)

if err.number <> 0 then
response.redirect "pt_supporterror.asp?error="& Server.Urlencode("ln 196 Error in showcart: "&err.description)
end if
'rddib=retry bid is excepted but not the high bid retry if you want%>
<form method="post" action="pt_showcart.asp?updatebid=<%=Session("pPrice")%>&check=chkb&processbid=1&rddib=2" name="updatebid"><%

else
'check if you already have a high bid
sql = "SELECT TOP 1 bidhistory.bidAmount AS price FROM bidhistory WHERE (((bidhistory.idProduct)="&Session("pIdProduct")&") AND ((bidhistory.idCustomerBid)="&session("idcustomer")&")) ORDER BY bidhistory.bidAmount DESC "
Session("highbidder") = true
'set rsMax = conntemp.execute(sql)
'pPriceMax = rsMax("price")

if CInt(pPriceMax) > CInt(Session("pPrice")) then
Response.Redirect "pt_viewitem.asp?bidstr="&priceMax&"&idproduct="&Session("pIdProduct")&"&1_zse=mbr"
end if
'high bidder so take the bid both for history and products
mySQL="INSERT INTO bidhistory ( idCustomerBid, idProduct, bidAmount, bidDate ) values ("&session("idcustomer")&","&Session("pIdProduct")&","&Session("pPrice")&",'"&now()&"')"
'Response.Write mySQL
'conntemp.execute(mySQL)

if err.number <> 0 then
'response.redirect "pt_supporterror.asp?error="& Server.Urlencode("ln 196 Error in showcart: "&err.description)
end if
mySQL="UPDATE products SET products.Price = "&Session("pPrice")&" WHERE (((products.idproduct)="&Session("pIdProduct")&"))"
'conntemp.execute(mySQL)
'Response.Write mySQL
'end if
if err.number <> 0 then
'response.redirect "pt_supporterror.asp?error="& Server.Urlencode("Error in viewitem: "&err.description)
end if
if Request.QueryString("inform")= 1 and Session("highbidder") <> true then%><!-- this says I am winning the bid-->
<font face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_18")%></font><img src="images/winning.jpg"></p>
<%else
Session("highbidder") = true
'Response.Redirect "pt_showcart.asp?processbid=1&check=chkb&inform=1&cnfrm=1&rddib=1" ' you are high bidder
end if%>
<%end if%>
<%end if%>

<table width="579"border="0">
<tr bgcolor="#D0CC98">
<td width="68" bgcolor="#89C0EB"><font color="white" face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_5")%></font></td>
<td width="301" bgcolor="#89C0EB"><font color="white" face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_6")%></font></td>
<!--<td width="55" bgcolor="#89C0EB"><font color="white" face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_16")%></font></td>-->

<td width="41" bgcolor="#89C0EB"><font color="white" face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_8")%></font></td>
<td width="79" bgcolor="#89C0EB"><font color="white" face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_9")%></font></td>
</tr>

<tr>
<td width="68"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><% response.write Session("pIdProduct")%></font></td>
<%if Request.QueryString("inform")= 1 then%>
<td width="301"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><a href="pt_viewitem.asp?idproduct=<%=Session("pIdProduct")%>"><% response.write Session("pDescription")%></a></font></td>
<%else%>
<td width="301"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><% response.write Session("pDescription")%></font></td>
<%end if%>
<td width="55"> <font face="Verdana, Arial, Helvetica, sans-serif"size="1"><%response.write pCurrencySign & money(Session("pPrice")) %></font></td>
<td width="79"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<a href="pt_cartremove.asp?cartIndex=<%response.write f%>" ><%response.write dictLanguage.Item(Session("language")&"_showcart_10")%></a></font></td>
</tr>
</table>
<br>
<%if Request.QueryString("processbid") = "1" and Session("highbidder") <> true then%>
<input type="submit" name="Submit" class=redbutton value="<%response.write dictLanguage.Item(Session("language")&"_showcart_17")%>">
<p>Your bid cannot be deleted!</p>
<%elseif Session("highbidder") = false then%>
<input type="submit" name="Submit" class=redbutton value="<%response.write dictLanguage.Item(Session("language")&"_showcart_11")%>">
<%End if%>
</form>
<br>
<b><font face="Arial, Helvetica, sans-serif" size="2"><%response.write dictLanguage.Item(Session("language")&"_showcart_12")%> <% response.write pCurrencySign & money(Session("pPrice")) %></font></b>
<font face="Arial, Helvetica, sans-serif" size="2"><i><!--<%response.write dictLanguage.Item(Session("language")&"_showcart_13")%>--> </i></font>
<br><br>
</div>
<%
call clearLanguage()
call closedb()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top