changeset 864:a8e1f257c182

hoge
author ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp>
date Thu, 22 Oct 2015 18:40:12 +0900
parents f05baac459f9
children 5a7fdc570aa9
files opencampus2015/#gohan.rb# opencampus2015/admin/#.htaccess# opencampus2015/img/inazuma1.png opencampus2015/img/inazuma2.png opencampus2015/img/inazuma3.png opencampus2015/img/inazuma4.png opencampus2015/img/inazuma5.png opencampus2015/img/ito1.png opencampus2015/img/ito2.png opencampus2015/img/ito3.png opencampus2015/img/ito4.png opencampus2015/img/ito5.png opencampus2015/img/kinoko1.png opencampus2015/img/kinoko2.png opencampus2015/img/kinoko3.png opencampus2015/img/kinoko4.png opencampus2015/img/kinoko5.png opencampus2015/img/medama1.png opencampus2015/img/medama2.png opencampus2015/img/medama3.png opencampus2015/img/medama4.png opencampus2015/img/medama5.png opencampus2015/img/momen1.png opencampus2015/img/momen2.png opencampus2015/img/momen3.png opencampus2015/img/momen4.png opencampus2015/img/momen5.png opencampus2015/img/tako1.png opencampus2015/img/tako2.png opencampus2015/img/tako3.png opencampus2015/img/tako4.png opencampus2015/img/tako5.png opencampus2015/list.csv opencampus2015/list2.csv opencampus2015/prof.rb opencampus2015/quest.rb
diffstat 36 files changed, 350 insertions(+), 141 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencampus2015/#gohan.rb#	Thu Oct 22 18:40:12 2015 +0900
@@ -0,0 +1,208 @@
+#!/usr/bin/env ruby22
+# -*- coding: utf-8 -*-
+require 'cgi'
+require 'sqlite3'
+require 'kconv'
+c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8")
+db = SQLite3::Database.new("sql/main.sq3")
+
+id = c.cookies["id"][0]
+person = id.to_i
+
+data = "select * from test where id = ?"
+   #idが?(後で代入)のデータをtest票から探す。という命令をdataにしくむ。全てがほしい場合は「*」。「*」を「name」に変えると該当データのnameだけとりだす。
+
+cook = db.execute(data, person)
+   #dataに仕組んでいた命令を、personを代入しつつ実行。
+
+upd = "update test set exp = ?, pt = ? where id = ?"
+   #「idが?3のとき、expを?1にする。ptを?2にする。」という命令文。
+lvupd = "update test set lv = ? where id = ?"
+
+que = "select q10 from toi where id = ?"
+queupd = "update toi set q10 = 1 where id = ?"
+q10 = db.execute(que, person)
+
+  name = cook[0][1]
+  cal = cook[0][2]
+  exp = cook[0][6]
+  pt = cook[0][7]
+  lv = cook[0][8]
+  per = "%"
+
+
+gohan = c["gohan"]
+
+if gohan == "g1" && pt >= 2
+  exp += 2
+  pt -= 2
+  db.execute(upd, exp, pt, person)  
+  kekka = "#{cal}が成長した!"
+elsif gohan == "g2" && pt >= 5
+  exp += 6
+  pt -= 5
+  db.execute(upd, exp, pt, person)
+  kekka = "#{cal}がすごく成長した!"
+elsif gohan == m3
+  if q10[0][0] == 0
+    exp += 10
+    db.execute(upd, exp, pt, person)  
+    kekka = ""
+    db.execute(queupd, person)
+  else
+    kekka ="しつもん に こたえられるのは いっかい だけだよ!"
+  end
+else
+  kekka = "ポイント が たりない!"
+end
+
+if gohan == m3
+elsif gohan == "g1"
+elsif gohan == "g2"
+else
+kekka = "こたえ が ちがうよ!"
+end
+
+
+if exp >= lv*10 && lv < 5
+  lv += 1
+  db.execute(lvupd, lv, person)
+  kekka += "<br>レベルが上がった!<br>レベルが#{lv}になった!"
+end
+
+
+if cal == "inu"
+  image = "./img/inu#{lv}.png"
+  alt = "inu#{lv}"
+elsif cal == "sisip"
+  image = "./img/sisip#{lv}.png"
+  alt = "sisip#{lv}"
+elsif cal == "kamon"
+  image = "./img/kamon#{lv}.png"
+  alt = "kamon#{lv}"
+elsif cal == "boy"
+  image = "./img/boy#{lv}.png"
+  alt = "boy#{lv}"
+elsif cal == "girl"
+  image = "./img/girl#{lv}.png"
+  alt = "girl#{lv}"
+elsif cal == "snake"
+  image = "./img/snake#{lv}.png"
+  alt = "snake#{lv}"
+else
+  image = "./img/snail.png"
+end
+
+if lv == 1
+  color = "black"
+elsif lv == 2
+  color = "navy"
+elsif lv == 3
+  color = "green"
+elsif lv == 4
+  color = "red"
+elsif lv == 5
+  color = "yellow"
+else
+  color = "pink"
+  image = "./img/snail.png"
+  alt = "snails_bug"
+end
+
+gage = 0
+exp2 = exp
+if lv < 5
+  while exp2 >= 10
+    exp2 -= 10
+  end
+  gage = 100-exp2*10
+end
+
+
+
+modoru = '<br><div class="f1"><a href="prof.rb"><div class="lets"><span>ホーム'
+back = modoru
+if lv < 5 && gohan == "g1" || lv < 5 && gohan == "g2"
+  mo = '<input type="button" value="おかわり!" onclick="location.reload();" />'
+  back = mo + modoru
+elsif lv >= 5
+  back += "<br>(レベルマックスだよ!)"
+end
+back += '</span></div></a></div>'
+
+cook = db.execute(data, person)
+exp = cook[0][6]
+pt = cook[0][7]
+lv = cook[0][8]
+  
+
+printf(<<_EOS_, per, gage, per, per, per, color, image, alt, name, person, cal, lv, pt, kekka, back)
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+
+<meta name="viewport"
+content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
+<meta name="format-detection" content="telephone=no">
+<link media="only screen and (max-device-width:480px)"
+href="smart.css" type="text/css" rel="stylesheet" />
+<link media="screen and (min-device-width:481px)" href="profeel.css"
+type="text/css" rel="stylesheet" />
+
+<link rel="shortcut icon" href="./img/exp.png"/>
+<title>ごはぁん!</title>
+<style type="text/css">
+<!--
+p.gage{
+background:#adf;
+margin-left:0%s;
+margin-right:%d%s;
+text-align:left;
+border-radius: 10ex;
+}
+div.gage{
+background:#ddf;
+margin-left:20%s;
+margin-right:20%s;
+border-radius: 10ex;
+}
+
+div.cal div{float:left; border:solid %s;}
+
+-->
+</style>
+</head>
+
+<body>
+<header></header>
+<h1>ほげほげ!</h1>
+
+<div class="cal">
+<div>
+<img src=%s alt=%s width="172" height="172">
+</div>
+<table class="state"><tr><td>name</td><td>:%s</td></tr>
+<tr><td>id</td><td>:%04d</td></tr>
+<tr><td>cara</td><td>:%s</td></tr>
+<tr><td>lv.</td><td>%d</td></tr>
+</table>
+</div>
+
+<div class="gage">
+<p class="gage">exp</p>
+</div>
+
+<p>
+
+こうえきポイント:%dp<br>
+%s
+</p>
+
+%s
+<footer></footer>
+</body>
+</html>
+
+_EOS_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencampus2015/admin/#.htaccess#	Thu Oct 22 18:40:12 2015 +0900
@@ -0,0 +1,10 @@
+AddHandler cgi-script   .rb
+AddType "text/html; charset=utf-8" .rb
+AddType "text/html; charset=utf-8" .html
+Options +ExecCGI
+AuthUserFile /home/www/skip/opencampus2015/admin/.htpasswd
+#AuthUserFile /home/irhome/c113/c113007/public_html/web/opencampus2015/admin/.htpasswd#for_roy
+AuthGroupFile /dev/null
+AuthName "splatoon! piyopiyogirl"
+AuthType Basic
+#require valid-user #This require make password
Binary file opencampus2015/img/inazuma1.png has changed
Binary file opencampus2015/img/inazuma2.png has changed
Binary file opencampus2015/img/inazuma3.png has changed
Binary file opencampus2015/img/inazuma4.png has changed
Binary file opencampus2015/img/inazuma5.png has changed
Binary file opencampus2015/img/ito1.png has changed
Binary file opencampus2015/img/ito2.png has changed
Binary file opencampus2015/img/ito3.png has changed
Binary file opencampus2015/img/ito4.png has changed
Binary file opencampus2015/img/ito5.png has changed
Binary file opencampus2015/img/kinoko1.png has changed
Binary file opencampus2015/img/kinoko2.png has changed
Binary file opencampus2015/img/kinoko3.png has changed
Binary file opencampus2015/img/kinoko4.png has changed
Binary file opencampus2015/img/kinoko5.png has changed
Binary file opencampus2015/img/medama1.png has changed
Binary file opencampus2015/img/medama2.png has changed
Binary file opencampus2015/img/medama3.png has changed
Binary file opencampus2015/img/medama4.png has changed
Binary file opencampus2015/img/medama5.png has changed
Binary file opencampus2015/img/momen1.png has changed
Binary file opencampus2015/img/momen2.png has changed
Binary file opencampus2015/img/momen3.png has changed
Binary file opencampus2015/img/momen4.png has changed
Binary file opencampus2015/img/momen5.png has changed
Binary file opencampus2015/img/tako1.png has changed
Binary file opencampus2015/img/tako2.png has changed
Binary file opencampus2015/img/tako3.png has changed
Binary file opencampus2015/img/tako4.png has changed
Binary file opencampus2015/img/tako5.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencampus2015/list.csv	Thu Oct 22 18:40:12 2015 +0900
@@ -0,0 +1,9 @@
+1,inazuma,30,10,25,45,60
+2,inu,25,8,15,25,35
+3,ito,10,3,6,9,12
+4,kamon,20,10,15,20,25
+5,kinoko,10,2,5,10,15
+6,medama,20,15,17,21,24
+7,momen,15,5,10,15,20
+8,snake,25,3,10,20,40
+9,tako,20,5,13,18,23
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencampus2015/list2.csv	Thu Oct 22 18:40:12 2015 +0900
@@ -0,0 +1,45 @@
+inazuma1
+inazuma2
+inazuma3
+inazuma4
+inazuma5
+inu1
+inu2
+inu3
+inu4
+inu5
+ito1
+ito2
+ito3
+ito4
+ito5
+kamon1
+kamon2
+kamon3
+kamon4
+kamon5
+kinoko1
+kinoko2
+kinoko3
+kinoko4
+kinoko5
+medama1
+medama2
+medama3
+medama4
+medama5
+momen1
+momen2
+momen3
+momen4
+momen5
+snake1
+snake2
+snake3
+snake4
+snake5
+tako1
+tako2
+tako3
+tako4
+tako5
--- a/opencampus2015/prof.rb	Tue Oct 20 19:29:53 2015 +0900
+++ b/opencampus2015/prof.rb	Thu Oct 22 18:40:12 2015 +0900
@@ -47,7 +47,7 @@
 <link media="screen and (min-device-width:481px)" href="profeel.css"
 type="text/css" rel="stylesheet" />
 <link rel="shortcut icon" href="./img/cabage.png"/>
-<title>ほげほげ</title>
+<title>Miyazac Quest</title>
 <style type="text/css">
 <!--
 -->
@@ -96,7 +96,7 @@
 ##################ptを獲得した際の反応。####################
 #########前の人が書き込んだ時間と比べて60秒以内なら追加ポイント####
 kpt = 0
-bom = c["bom"]                        ####<form ~~ name="bom">より
+
 
 begin
   jikan2 = db.execute(jikan1, "j")
@@ -114,22 +114,6 @@
   db.execute(ins4, "j")
 end
 
-if bom == "please skip here"
-  jikan2 = db.execute(jikan1, "j")
-  now1 = jikan2[0][1]
-  nowper = jikan2[0][2]
-  now2 = Time.now.to_i
-  db.execute(timeupd, now2, person, "j")
-  if person == nowper
-  elsif now1 == nil
-  elsif now2-now1 < 2                 ####2秒以内なら~
-    pt += 50
-    kpt += 50
-  end
-  pt += 1
-  kpt += 1
-  #  db.execute(bomd, pt, person)
-end
 
 qrAC = qrc            ###生成したハッシュには、"乱数"=>"記号"が入っている
 getAC = ARGV[0].to_i  ###URL?以降の文字(特定の乱数)を取得してgetACに代入
@@ -216,64 +200,16 @@
 db.execute(queupd, q1, q2, q3, q4, q5, person)
 
 kkget = ""
-if kpt > 0
-  kkget = "#{kpt}ポイントゲット!!"
-end
-
-
 
 ########################~ここまでpt処理~###################
 #######################################################
 
-if cal == "inu"
-  image = "./img/inu#{lv}.png"
-  alt = "inu#{lv}"
-  m1 = "ドッグフード"
+  m1 = "馬小屋"
   mimg1 = "./img/food.png"
-  m2 = "にく"
+  m2 = "客室"
   mimg2 = "./img/niku.png"
-elsif cal == "sisip"
-  image = "./img/sisip#{lv}.png"
-  alt = "sisip#{lv}"
-  m1 = "ぱん"
-  mimg1 = "./img/pan.png"
-  m2 = "きゃべつ"
-  mimg2 = "./img/kyabetsu.png"
-elsif cal == "kamon"
-  image = "./img/kamon#{lv}.png"
-  alt = "kamon#{lv}"
-  m1 = "かい"
-  mimg1 = "./img/kai.png"
-  m2 = "とびうお"
-  mimg2 = "./img/fish.png"
-elsif cal == "boy"
-  image = "./img/boy#{lv}.png"
-  alt = "boy#{lv}"
-  m1 = "いか"
-  mimg1 = "./img/ship.png"
-  m2 = "つやひめ"
-  mimg2 = "./img/tsuya.png"
-elsif cal == "girl"
-  image = "./img/girl#{lv}.png"
-  alt = "girl#{lv}"
-  m1 = "さくらんぼ"
-  mimg1 = "./img/room.png"
-  m2 = "つやひめ"
-  mimg2 = "./img/tsuya.png"
-elsif cal == "snake"
-  image = "./img/snake#{lv}.png"
-  alt = "snake#{lv}"
-  m1 = "かえる"
-  mimg1 = "./img/exp.png"
-  m2 = "ねずみ"
-  mimg2 = "./img/exp.png"
-else
-  image = "./img/snail.png"
-  m1 = "たまごのから"
-  mimg1 = "./img/tamago.png"
-  m2 = "きゃべつ"
-  mimg2 = "./img/cabage.png"
-end
+image = "./img/#{cal}#{lv}.png"
+alt = "#{cal}.png"
 
 
 
@@ -315,78 +251,7 @@
 ########################
 ###lv==5のとき画像を変える###
 comm = ""
-if ARGV[0] == "commandbomd"
-comm += '<form method="POST" action="prof.rb?commandbomd">
-<input type="text" name="bom" size="8">
-<input type="submit">
-</form>'
-elsif lv == 5
-comm += '<form method="POST" action="prof.rb">
-<input type="text" name="bom" size="8">
-<input type="submit">
-</form>'
-end
 
-if bom == "inu1"
-image = "./img/inu1.png"
-elsif bom == "inu2"
-image = "./img/inu2.png"
-elsif bom == "inu3"
-image = "./img/inu3.png"
-elsif bom == "inu4"
-image = "./img/inu4.png"
-elsif bom == "inu5"
-image = "./img/inu5.png"
-
-elsif bom == "sisip1"
-image = "./img/sisip1.png"
-elsif bom == "sisip2"
-image = "./img/sisip2.png"
-elsif bom == "sisip3"
-image = "./img/sisip3.png"
-elsif bom == "sisip4"
-image = "./img/sisip4.png"
-elsif bom == "sisip5"
-image = "./img/sisip5.png"
-
-elsif bom == "kamon1"
-image = "./img/kamon1.png"
-elsif bom == "kamon2"
-image = "./img/kamon2.png"
-elsif bom == "kamon3"
-image = "./img/kamon3.png"
-elsif bom == "kamon4"
-image = "./img/kamon4.png"
-elsif bom == "kamon5"
-image = "./img/kamon5.png"
-
-elsif bom == "boy1"
-image = "./img/boy1.png"
-elsif bom == "boy2"
-image = "./img/boy2.png"
-elsif bom == "boy3"
-image = "./img/boy3.png"
-elsif bom == "boy4"
-image = "./img/boy4.png"
-elsif bom == "boy5"
-image = "./img/boy5.png"
-
-elsif bom == "girl1"
-image = "./img/girl1.png"
-elsif bom == "girl2"
-image = "./img/girl2.png"
-elsif bom == "girl3"
-image = "./img/girl3.png"
-elsif bom == "girl4"
-image = "./img/girl4.png"
-elsif bom == "girl5"
-image = "./img/girl5.png"
-end
-
-if bom == ""
-else
-  image = "./img/#{bom}.png"
-end
 kakunin = ""
 #########################
 #########################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencampus2015/quest.rb	Thu Oct 22 18:40:12 2015 +0900
@@ -0,0 +1,72 @@
+#!/usr/bin/env ruby22
+# -*- coding: utf-8 -*-
+
+require 'sqlite3'
+require 'kconv'
+require 'cgi'
+
+c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8")
+db = SQLite3::Database.new("sql/main.sq3")
+
+id = c.cookies["id"][0].to_i
+cmps = c["cmps"]
+
+#card = "select " 設定してる予定のi1,i2,i3を選びたい。どこから? メインテーブル? それようのテーブル?
+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
+if cmps == "↑"
+exp += 2 
+end
+
+db.execute(expup,exp,id)
+
+
+printf(<<_EOS_,cmps)
+
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+
+<meta name="viewport"
+content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
+<meta name="format-detection" content="telephone=no">
+<link media="only screen and (max-device-width:480px)"
+href="smart.css" type="text/css" rel="stylesheet" />
+<link media="screen and (min-device-width:481px)" href="profeel.css"
+type="text/css" rel="stylesheet" />
+
+
+
+
+<link rel="shortcut icon" href="./img/cabage.png"/>
+<title>だぁんじょん</title>
+<style type="text/css">
+<!--
+-->
+</style>
+</head>
+
+<body>
+<h1>だぁんじょん%s</h1>
+
+<div class="gage">
+<p class="gage">exp</p>
+</div>
+<p>こうえきポイント:</p>
+<form method="POST" action="quest.rb">
+<input type="submit" name="cmps" value="←" disabled>
+<input type="submit" name="cmps" value="↑">
+<input type="submit" name="cmps" value="→">
+</form>
+
+
+
+<footer></footer>
+</body>
+</html>
+
+_EOS_

yatex.org