<%@ page contentType="text/html; charset=EUC-JP" %> <%@ page import = "java.util.*, java.io.*, java.text.*, java.sql.*, java.util.Date" %> <%@ page errorPage="/syserror.jsp" %> <%! private String NumFormat(String num) { int n = Integer.valueOf(num).intValue(); DecimalFormat NumFormat = new DecimalFormat("###,###"); return NumFormat.format(n); } private String StrConv(String name, String val) throws UnsupportedEncodingException { if(val!=null){ StringBuffer sb = new StringBuffer(); StringCharacterIterator sci = new StringCharacterIterator(val); for(char c = sci.current(); c != StringCharacterIterator.DONE; c = sci.next()){ if(c == '\n') { sb.append("
"); } else if(c == '\r') { sb.append(""); } else { sb.append(c); } } return sb.toString() + ""; } else { return ""; } } %> <% int total = 0, row = 0, point = -1; String cart = ""; String goods = request.getParameter("goods"); String id, login, password, query, name="", errmsg = ""; ResultSet rs; db.open(); String login_default = ""; Cookie[] cookies = request.getCookies(); if (cookies != null) { for(int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals("ikari_id")) { Cookie myCookie = cookies[i]; login_default = (String)myCookie.getValue(); if (session.getAttribute("ikari_user")==null) { query = "SELECT lname, fname FROM users WHERE del is not true AND login = '" + login_default +"'"; rs = db.select(query); if (rs.next()) { session.setAttribute("ikari_user", rs.getString("lname") + rs.getString("fname")); } } } } } if (request.getParameter("login")!=null) { login = request.getParameter("login"); password = request.getParameter("password"); query = "SELECT * FROM users WHERE del is not true AND login = '" + login + "' AND password = '" + password + "'"; rs = db.select(query); if(rs.next()) { if (rs.getString("sub_id")!=null) { id = rs.getString("id"); name = rs.getString("lname") + rs.getString("fname"); session.setAttribute("ikari_id", id); session.setAttribute("ikari_user", name); Cookie cookie = new Cookie("ikari_id", login); cookie.setMaxAge(60 * 60 * 24 * 365); cookie.setPath("/"); response.addCookie(cookie); query = "SELECT point FROM users, ikari_point WHERE del is not true AND users.ikari_card_id = ikari_point.id AND users.id = " + id; rs = db.select(query); if (rs.next()) { point = rs.getInt("point"); session.setAttribute("ikari_point", new Integer (point)); } else { session.setAttribute("ikari_point", new Integer (-1)); } } else { id = ""; errmsg = "このIDは会員登録が完了していません"; } } else { id = ""; errmsg = "IDまたはパスワードが違います"; } } else { id = (String) session.getAttribute("ikari_id"); name = (String) session.getAttribute("ikari_user"); } if (session.getAttribute("ikari_point")!=null) { Integer pt = (Integer)session.getAttribute("ikari_point"); point = pt.intValue(); }if (request.getParameter("cart")!=null && request.getParameter("cart").equals("yobi")) { cart = "yobi"; } if (request.getParameter("cart.x")!=null) { int c = -1; String ctmp = request.getParameter("count"); for (int i = 0; i < ctmp.length(); i++) { char ch = ctmp.charAt(i); if (ch < '0' || ch > '9') { c = 1; break; } } if (ctmp.length() == 0) { c = 1; } if (c < 0) { c = Integer.valueOf(ctmp).intValue(); } Integer count = (Integer)session.getAttribute("cart_"+goods); if (count == null) { count = new Integer (c); } else { count = new Integer (count.intValue() + c); } session.setAttribute("cart_"+goods, count); } else if (request.getParameter("yobicart.x")!=null) { session.setAttribute("yobi_"+goods, new Integer (1)); cart = "yobi"; } else if (request.getParameter("plus.x")!=null) { Integer count = (Integer)session.getAttribute("cart_"+goods); if (count == null) { count = new Integer (1); } else { count = new Integer (count.intValue() + 1); } session.setAttribute("cart_"+goods, count); } else if (request.getParameter("minus.x")!=null) { Integer count = (Integer)session.getAttribute("cart_"+goods); if (count == null || count.intValue() <= 1) { count = new Integer (0); session.removeAttribute("cart_"+goods); } else { count = new Integer (count.intValue() - 1); session.setAttribute("cart_"+goods, count); } } else if (request.getParameter("move.x")!=null) { session.setAttribute("yobi_"+goods, new Integer (1)); session.removeAttribute("cart_"+goods); } else if (request.getParameter("move2.x")!=null) { session.setAttribute("cart_"+goods, new Integer (1)); session.removeAttribute("yobi_"+goods); cart = "yobi"; } else if (request.getParameter("delete.x")!=null) { session.removeAttribute("cart_"+goods); } else if (request.getParameter("delete2.x")!=null) { session.removeAttribute("yobi_"+goods); cart = "yobi"; } Enumeration sess=session.getAttributeNames(); %> 〜本当のおいしさを〜いかりスーパー
<% if(id!=null && !id.equals("")) { %> <% } else { %> <% } %>
いらっしゃいませ
<%=name%>様
>カートの使い方
登録情報変更
いらっしゃいませ
<% if (name!=null && name.length() > 0) { %> <% } else { %> <% } %> <%=errmsg%>
<%=name%>様ゲスト様
▼ログインする
ID: PASS:
新規登録する
>メンバー登録について
>パスワードを忘れた方はこちら
<% if (cart.equals("yobi")) { %>

▼カートの中身
メモの中身
商品名       価格       移動
<% while(sess.hasMoreElements()) { %> <% String sess_name = (String) (sess.nextElement()); StringTokenizer tkn = new StringTokenizer(sess_name, "_"); if (tkn.countTokens() < 2) { continue; } String sess_key = tkn.nextToken(); String cart_id = tkn.nextToken(); if (sess_key.equals("yobi")) { query = "SELECT * FROM goods WHERE del is not true AND (start_date <= current_timestamp or start_date is null) AND (end_date >= current_timestamp or end_date is null) AND id = " + cart_id; rs = db.select(query); rs.next(); Integer count = (Integer)session.getAttribute(sess_name); total += rs.getInt("price") * count.intValue(); row = rs.getRow(); %>
<%=rs.getString("product")%>
¥<%=NumFormat(rs.getString("price"))%>

<% } %> <% } %> <% if (row < 1) { %> 現在メモに入っている商品はありません。 <% } %>
<% } else { %>

▼カートの中身
メモの中身
商品名       価格   購入数 移動
<% while(sess.hasMoreElements()) { %> <% String sess_name = (String) (sess.nextElement()); StringTokenizer tkn = new StringTokenizer(sess_name, "_"); if (tkn.countTokens() < 2) { continue; } String sess_key = tkn.nextToken(); String cart_id = tkn.nextToken(); if (sess_key.equals("cart")) { query = "SELECT * FROM goods WHERE del is not true AND (start_date <= current_timestamp or start_date is null) AND (end_date >= current_timestamp or end_date is null) AND id = " + cart_id; rs = db.select(query); rs.next(); Integer count = (Integer)session.getAttribute(sess_name); total += rs.getInt("price") * count.intValue(); row = rs.getRow(); %>
<%=rs.getString("product")%>
¥<%=NumFormat(rs.getString("price"))%> <%=session.getAttribute(sess_name)%>

<% } %> <% } %> <% if (row < 1) { %> 現在カートに入っている商品はありません。 <% } %>
<% if (total > 0) { %>
商品合計金額¥<%=NumFormat(String.valueOf(total))%>
(送料・手数料は含まれておりません)
<% } %>
<% } %> <% query = "SELECT *, to_char (start_date, 'mm/dd') as sdate FROM comment WHERE del is not true AND (start_date <= current_timestamp OR start_date is null) ORDER BY id DESC LIMIT 1"; ResultSet comment = db.select(query); %> <% if(comment.next()) { %>
カテゴリ 全て見る
新入荷商品
新入荷商品を集めました!
オリーブオイル特集
イタリア産 最高品質の天然100%ジュース!
春の味覚大集合!
春を告げる季節限定商品が勢ぞろい!
ワイン・お酒
ソムリエがセレクトした高品質なお酒
チーズ・乳製品
風味豊かに料理・ワインを盛りあげる
オリジナル惣菜
いかりだけのオリジナル商品
極めつけ調味料
カラダにおいしい極みの調味料
お菓子・デザート
原材料の持ち味をそのままおいしく
肉・卵・魚加工品
おいしい産地から選りすぐりの商品
鮮度も大切に。精米仕立てでお届け
豆腐・納豆
国産大豆で大豆の栄養そのままに
コーヒー・ドリンク
毎日の食生活に飲む栄養素を
いかりバッグ
40年以上変わらないデザインをお手元へ
直輸入商品
世界各国のおいしさを直輸入

メールマガジン
<% } %> <% query = "SELECT * FROM news WHERE del is not true AND (start_date <= current_timestamp OR start_date is null) AND (end_date >= current_timestamp OR end_date is null) ORDER BY id DESC LIMIT 3"; ResultSet news = db.select(query); %> <%if (news.getFetchSize() > 0){%>
いかりニュース
<% while(news.next()) { %> <% } %>
<%=StrConv("title", news.getString("title"))%>
  >>詳しくはこちらへ
<% } %> <% query = "SELECT *, to_char (start_date, 'mm月dd日') as sdate, to_char (end_date, 'mm月dd日') as edate FROM campaign WHERE del is not true AND (start_date <= current_timestamp or start_date is null) AND (end_date >= current_timestamp or end_date is null) AND status = 1"; ResultSet campaign = db.select(query); %> <% if(campaign.next()) { %>
今月のキャンペーン
●<%=StrConv("title", campaign.getString("title"))%>
<% if(campaign.getString("sdate")!=null) { %> <%=campaign.getString("sdate")%> <% } %> <% if(campaign.getString("edate")!=null) { %> 〜<%=campaign.getString("edate")%> <% } %>
<%=StrConv("text_s", campaign.getString("text_s"))%>
詳しくはこちらへ
<% } %> <% query = "SELECT * FROM shop_news WHERE del is not true AND (start_date <= current_timestamp OR start_date is null) AND (end_date >= current_timestamp OR end_date is null) ORDER BY id DESC LIMIT 3"; ResultSet snews = db.select(query); %> <%if (snews.getFetchSize() > 0){%>
いかり店舗ニュース
<% while(snews.next()) { %> <% } %>
●<%=StrConv("shop", snews.getString("shop"))%>からのお知らせ
 <%=StrConv("title", snews.getString("title"))%>
>>詳しくはこちらへ
ニュース写真
<% } %>
特定商取引について
いかりスーパーマーケットとは
いかりの店舗詳細情報
いかりのオススメリンク
店舗情報サイトはこちら
<% db.close(); %>