changeset 870:667f8ae73792

cle8
author ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp>
date Fri, 23 Oct 2015 14:21:16 +0900
parents 644d022c37d1
children fb7551b76cdf
files opencampus2015/accountcheck.rb opencampus2015/prof.rb opencampus2015/profeel.css opencampus2015/quest.rb
diffstat 4 files changed, 26 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/opencampus2015/accountcheck.rb	Fri Oct 23 13:29:32 2015 +0900
+++ b/opencampus2015/accountcheck.rb	Fri Oct 23 14:21:16 2015 +0900
@@ -4,10 +4,11 @@
 require 'sqlite3'
 require 'kconv'
 require 'cgi'
+require 'csv'
 
 c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8")
 db = SQLite3::Database.new("sql/main.sq3")
-
+csv = "list.csv"
 
 sql = "insert into test values(?, ?, ?, ?, ?, ?, ?, ?, ?)"
 
@@ -42,18 +43,12 @@
 db.execute(cle7)
 db.execute(cle8)
 if name == "createman789789789"
-db.execute(ins4, "a")
-db.execute(ins4, "b")
-db.execute(ins4, "c")
-db.execute(ins4, "d")
-db.execute(ins4, "e")
-db.execute(ins4, "f")
-db.execute(ins4, "g")
-db.execute(ins4, "h")
-db.execute(ins4, "i")
-db.execute(ins4, "j")
+  ("a".."j").each{|x|db.execute(ins4,x)}
 db.execute(ins5)
-system `sqlite3 -separator , /sql/main.sq3 ".import list.csv zukan"` #(cle8)
+#system `sqlite3 -separator , /sql/main.sq3 ".import list.csv zukan"` #(cle8)
+CSV.foreach(csv) do |row|
+db.execute("INSERT INTO zukan VALUES(?,?,?,?,?,?,?)",*row)
+end
 end
 
 name = c["name"]
--- a/opencampus2015/prof.rb	Fri Oct 23 13:29:32 2015 +0900
+++ b/opencampus2015/prof.rb	Fri Oct 23 14:21:16 2015 +0900
@@ -234,23 +234,14 @@
 #(exp=35の場合、5*10=『50%』、次のレベルアップまであと50%が必要、と分かる。)
 gage = 0
 exp2 = exp
-esa = "<br><br><br>"
-if lv < 5
-  while exp2 >= 10
-    exp2 -= 10
-  end
-  gage = 100-exp2*10
-  esa ='<input type="reset" value="とりけし">
-<input type="submit" value="こうかんする!"><br>
-<input type="text" name="gohan" placeholder="ひみつ の こたえ を いれてね!">:0pt'
-end
+#esa = "<br><br><br>"
+
 
 
 
 
 ########################
 ###lv==5のとき画像を変える###
-comm = ""
 
 kakunin = ""
 #########################
@@ -258,7 +249,7 @@
 ###################################--HTML--##################
 ###################################--------##################
 
-printf(<<_EOS_, per, gage, per, per, per, color, kakunin, kkget, image, alt, name, person, cal, lv, comm, pt, m1, mimg1, m2, mimg2, esa)
+printf(<<_EOS_, per, gage, per, per, per, color, kakunin, kkget, image, alt, name, person, cal, lv, pt, m1, mimg1,m2,mimg2)
 
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
@@ -302,7 +293,7 @@
 
 <body>
 <header><p>%s</p></header>
-<h1>Miyazac quest</h1>
+<h1>Miyazac Quest</h1>
 <h2>%s</h2>
 
 <div class="cal">
@@ -320,23 +311,20 @@
 <p class="gage">exp</p>
 </div>
 
-%s
-
-<p>coin:%dp</p>
+<form method="POST" action="quest.rb">
+<input type="submit" value="~魔王の迷宮へ~">
+</form>
+<p>coin:%d$</p>
 <table><tr><td>
 <form method="POST" action="gohan.rb">
 <label><input type="checkbox" name="hdn">宿屋<div><br>
-<label><input type="radio" name="gohan" value="g1">%s:2pt<img src=%s width="16" height="16"></label><br>
-<label><input type="radio" name="gohan" value="g2">%s:5pt<img src=%s width="16" height="16"></label><br>
-%s
+<label><input type="radio" name="gohan" value="g1">%s:0$<img src=%s width="16" height="16"></label><br>
+<label><input type="radio" name="gohan" value="g2">%s:5$<img src=%s width="16" height="16"></label><br>
+<input type="reset" value="やめる">
+<input type="submit" value="泊まる"></div></label><br>
+
 </div></label></form>
 </td><td>
-<form method="POST" action="gets.rb">
-<label><input type="checkbox" name="hdn">しょうひんと交換!<div><br>
-<label><input type="radio" name="sho" value="s1">おかし:?pt</label><br>
-<input type="reset" value="とりけし">
-<input type="submit" value="こうかんする!"></div></label><br>
-
 </form>
 </td></tr></table>
 <footer></footer>
--- a/opencampus2015/profeel.css	Fri Oct 23 13:29:32 2015 +0900
+++ b/opencampus2015/profeel.css	Fri Oct 23 14:21:16 2015 +0900
@@ -1,5 +1,5 @@
 body{text-align:center;
-background:#bff;
+background:#355;
 border:dashed 5px navy;
 }
 header{
@@ -30,8 +30,8 @@
 header p {color:red;}
 
 h1{
-color:#e90;
-border:solid 5px #fa0;
+color:#0d4;
+border:solid 5px #a00;
 border-style:double;
 background:url("./img/lvb.png");
 background-color:red;
--- a/opencampus2015/quest.rb	Fri Oct 23 13:29:32 2015 +0900
+++ b/opencampus2015/quest.rb	Fri Oct 23 14:21:16 2015 +0900
@@ -15,7 +15,7 @@
 exppoint = "select e1 from box where id = ?"  #じぶんのidのboxにある一体目の経験値
 expup = "update box set e1 = ? where id = ?"
 exp2 = db.execute(exppoint,id)
-exp = exp2[0][0].to_i
+exp = exp2[0].to_i
 if cmps == "↑"
 exp += 2 
 end
@@ -23,7 +23,7 @@
 db.execute(expup,exp,id)
 
 
-printf(<<_EOS_,cmps)
+printf(<<_EOS_,cmps,exp2)
 
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
@@ -52,7 +52,7 @@
 
 <body>
 <h1>だぁんじょん%s</h1>
-
+<p>%s</p>
 <div class="gage">
 <p class="gage">exp</p>
 </div>

yatex.org