?? cashsave.jsp
字號:
<%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
<link href="css.css" rel="stylesheet" type="text/css">
<jsp:useBean id="mdb" class="ckstudio.db.faq" scope="page"/>
<head>
<script language="JavaScript">
<!--
if (parent.frames.length > 0) {
parent.location.href = location.href;
}
function form1_onsubmit() {
if (document.form1.sub_to.value=="")
{
alert("收貨人姓名不能為空。")
document.form1.sub_to.focus()
return false
}
else if(document.form1.sub_adds.value=="")
{
alert("收貨人地址不能為空。")
document.form1.sub_adds.focus()
return false
}
else if(document.form1.sub_post.value=="")
{
alert("收貨人郵編不能為空。")
document.form1.sub_post.focus()
return false
}
else if(document.form1.sub_tel.value=="")
{
alert("聯系電話不能為空。")
document.form1.sub_tel.focus()
return false
}
else if(document.form1.sub_mail.value=="")
{
alert("聯系信箱不能為空。")
document.form1.sub_mail.focus()
return false
}
}
// -->
</script>
<link href=css.css rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>購物成功!請填寫收貨人的詳細信息</title>
</head>
<body topmargin="0">
<font color="#FFFFFF"><b>
<%
if(session.getAttribute("user_name")==null){%><br><center>1.你尚未登錄!請登錄后再訂購本站圖書!<br>2.第一次來本站,請先注冊會員(免費)!<br><br><%
}else
{
String count="";
String hw_id="";
if(request.getParameter("action")=="buy"){
if(request.getParameter("count")==""){
int intcount=1;
count=Integer.toString(intcount);
}
else
count=request.getParameter("count");
if(request.getParameter("hw_id")=="")
out.print("沒有此貨物!");
else{
hw_id=request.getParameter("hw_id");
String sql="select * from basket where hw_id='"+hw_id+"' and user_name='"+(String)session.getValue("user_name")+"' and basket_check=false";
ResultSet rs;
rs=mdb.executeQuery(sql);
if(!rs.next()){
String sql1="insert into basket(hw_id,user_name,basket_count,hw_name,hw_cash,user_type) values('"+hw_id+"','"+session.getValue("user_name")+"','"+count+"','"+request.getParameter("hw_name")+"','"+request.getParameter("hw_cash")+"','"+request.getParameter("user_type")+"') where hw_id='"+hw_id+"' and user_name='"+session.getValue("user_name")+"' and basket_check=false";
mdb.executeInsert(sql1);
}
else{
//rs("basket_count")=int(rs("basket_count"))+int(count)
rs.next();
int basket_count=Integer.parseInt(rs.getString("basket_count"));
basket_count=basket_count+Integer.parseInt(count);
String basket_count2=Integer.toString(basket_count);
String sql2="update basket set basket_count='"+basket_count+"'";
mdb.executeUpdate(sql2);
}
}
}
%>
</b></FONT>
<br>
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center" height="65">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td valign="top" height="120"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="5" align="center">
<%if(session.getAttribute("user_name")==null)
response.sendRedirect("index.jsp");
else{
String user_name;
user_name=(String)session.getValue("user_name");
String sql1;
sql1="select * from basket where user_name='"+user_name+"' and basket_check=false";
ResultSet rs1;
rs1=mdb.executeQuery(sql1);
if(!rs1.next())
out.print("你沒有訂購任何商品");
else{
String sub_number="";
String now=(String)((new java.util.Date()).toLocaleString());
sub_number=user_name+now;
sub_number=sub_number.replace('-','1');
sub_number=sub_number.replace(' ','2');
sub_number=sub_number.replace(':','3');
rs1.previous();
while(rs1.next()){
String b_c=rs1.getString("basket_count");
String h_id=rs1.getString("hw_id");
String sql2="update basket set basket_check=true,sub_number='"+sub_number+"' where user_name='"+user_name+"' and basket_check=false";
mdb.executeUpdate(sql2);
int h_i=Integer.parseInt(h_id);
String sql3="select * from hw where hw_id="+h_i+"";
ResultSet rs2=mdb.executeQuery(sql3);
rs2.next();
int h_b=rs2.getInt("hw_buys")+Integer.parseInt(b_c);
String sql4="update hw set hw_buys="+h_b+" where hw_id="+h_i+"";
mdb.executeUpdate(sql4);
}
String sql5="insert into sub(user_name,sub_number) values('"+user_name+"','"+sub_number+"')";
mdb.executeInsert(sql5);
%>
<tr>
<td>
<img border="0" src="img/promo_list_top.gif" width="100%" height="4"></td>
</tr>
<tr>
<td height="17" bgcolor="#DBC2B0" align="center">謝謝您從本站購物!您的訂單號為:<font color=#FFFF00><b><%=sub_number%></b></font></td>
</tr>
<tr>
<td width="380"> <form method="POST" language="javascript" onsubmit="return form1_onsubmit()" name="form1" action="saveto.jsp?sub_number=<%=sub_number%>">
<%
String sql6;
sql6="select * from member where user_name='"+(String)session.getValue("user_name")+"'";
ResultSet rs3=mdb.executeQuery(sql6);
rs3.next();
%><table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td><table width="100%" height="34" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="398" height="120" valign="bottom" bgcolor="#F5EFE7" ><br>
請記牢本訂單號,你可以使用本訂單號對成交情況進行查詢和投訴<br> <br>
<div align="center">
<center>
<table width="90%" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" height="243">
<tr background="img/pics/tile_bg.gif">
<td height="25" colspan="2"><b>請填寫收貨人的詳細信息</b></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="25" bgcolor="#F5EFE7">
<div align="right">姓名:</div>
</td>
<td width="81%" height="25" bgcolor="#F5EFE7">
<input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_to" size="20" class=input value="<%=rs3.getString("user_name")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="25" bgcolor="#F5EFE7">
<div align="right">地址:</div>
</td>
<td height="25" bgcolor="#F5EFE7">
<input style="FONT-SIZE: 12px; WIDTH: 210px" type="text" name="sub_adds" size="40" class=input value="<%=rs3.getString("user_adds")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="25" bgcolor="#F5EFE7">
<div align="right">郵編:</div>
</td>
<td height="25" bgcolor="#F5EFE7">
<input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_post" size="10" class=input value="<%=rs3.getString("user_postcode")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="25" bgcolor="#F5EFE7">
<div align="right">電話:</div>
</td>
<td height="25" bgcolor="#F5EFE7">
<input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_tel" size="20" class=input value="<%=rs3.getString("user_tel")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="25" bgcolor="#F5EFE7">
<div align="right">E-mail:</div>
</td>
<td height="25" bgcolor="#F5EFE7">
<input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_mail" size="20" class=input value="<%=rs3.getString("user_mail")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="19" bgcolor="#F5EFE7">
<div align="right">付款方式:</div>
</td>
<td height="19" bgcolor="#F5EFE7">
<select size="1" name="qian">
<option value="貨到付款">貨到付款</option>
<option value="銀行轉帳">銀行轉帳</option>
<option value="郵政匯款">郵政匯款</option>
</select>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="39" bgcolor="#F5EFE7">
<div align="right">備注:<br>
(50漢字內) </div>
</td>
<td height="39" bgcolor="#F5EFE7">
<textarea style="FONT-SIZE: 12px; WIDTH: 250px" name="other" cols="30" class="input" rows="3"></textarea>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="35" colspan="2" bgcolor="#F5EFE7">
<table width="40%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<input
align=absMiddle alt=確認 cache name="B1"
src="img/pics/ok.gif" type=image tppabs="" width="45" height="20">
</div>
</td>
<td>
<div align="center">
<input type="reset" value="清除" name="B2" class=input>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
<br> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle"><div align="center"><img src="img/pics/seperator.gif" width="359" height="1"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1" colspan="3" valign="top"></td>
</tr>
</table> </td>
</tr>
</table>
<%
}
}
%>
</form></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<%}
mdb.Close();
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -