changeset 909:e3d3137632de

DO NOT INCLUDE BACKUP FILE (#*#).
author HIROSE Yuuji <yuuji@koeki-u.ac.jp>
date Thu, 05 Nov 2015 11:03:02 +0859
parents 5969c7473556
children 63d09641ab0b
files .hgignore oasis2015/#gets.rb# oasis2015/admin/#check.rb# opencampus2015/#battle.rb#
diffstat 4 files changed, 1 insertions(+), 501 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Nov 05 11:02:08 2015 +0859
+++ b/.hgignore	Thu Nov 05 11:03:02 2015 +0859
@@ -2,4 +2,4 @@
 *.eps
 *.dat
 *.sq3
-#*
+\#*
--- a/oasis2015/#gets.rb#	Thu Nov 05 11:02:08 2015 +0859
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-#!/usr/bin/env ruby22
-# -*- coding:utf-8 -*-
-
-require 'sqlite3'
-require 'cgi'
-
-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 = ?"
-cook = db.execute(data, person)
-upd = "update test set pt = ? where id = ?"
-goods = "update goods set g1 = ?, g2 = ?, g3 = ?, g4 = ?, g5 = ?, g6 = ? where id = ?"
-
-
-name = cook[0][1]
-pt = cook[0][7]
-lv = cook[0][8]
-
-ticket = "select * from goods where id = ?"
-have = db.execute(ticket, person)
-g1 = have[0][1]
-g2 = have[0][2]
-g3 = have[0][3]
-g4 = have[0][4]
-g5 = have[0][5]
-g6 = have[0][6]
-
-gets = c["sho"]
-c1 = 10         #商品それぞれに対して消費するポイント
-c2 = 6
-c3 = 8
-c4 = 2
-c5 = 5
-c6 = 100
-n1 = "オランダせんべい"      #商品それぞれの名前
-n2 = "温ビール"
-n3 = "ハンドクリーム"
-n4 = ""
-
-h1 = "チケットを発行したよ!<br>海洋センター3階でスタッフの人と商品をこうかんしてね!"
-if lv < 3
-  h1 = "チケット発行できません!"
-  kekka = "レベル が たりないよ!"
-elsif gets == "s1" && pt >= c1
-  g1 += 1
-  pt -= c1
-  kekka = "#{n1}交換券をゲット!"
-elsif gets == "s2" && pt >= c2
-  g2 += 1
-  pt -= c2
-  kekka = "#{n2}交換券をゲット!"
-elsif gets == "s3" && pt >= c3
-  g3 += 1
-  pt -= c3
-  kekka = "#{n3}交換券をゲット!"
-elsif gets == "s4" && pt >= c4
-  g4 += 1
-  pt -= c4
-  kekka = "あめ交換券をゲット!"
-elsif gets == "s5" && pt >= c5
-  g5 += 1
-  pt -= c5
-  kekka = "10円金券をゲット!"
-elsif gets == "s6" && pt >= c6
-  g6 += 1
-  pt -= c6
-  kekka = "まぐろ交換券をゲット!"
-else
-  h1 = "チケット発行できません!!"
-  kekka = "ポイントとかたりません!"
-end
-
-trade = c["trade"]
-if trade == n1 && g1 > 0
-  g1 -= 1
-  kekka = "#{n1} と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!"
-  h1 = "#{n1}と交換します!<br>こぼさないで たべてね!"
-elsif trade == n2 && g2 > 0
-  g2 -= 1
-  kekka = "#{n2} と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、年齢を確認してから交換してください!"
-  h1 = "#{n2} と交換します!<br>ひやしてから おうち で のんでね!"
-elsif trade == n3 && g3 > 0
-g3 -= 1
-kekka = "#{n3} と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!"
-  h1 = "#{n3}と交換します!"
-elsif trade == n4 && g4 > 0
-g4 -= 1
-kekka = "あめ と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!"
-h1 = "あめと交換します!"
-elsif trade == "10えん金券" && g5 > 0
-g5 -= 1
-kekka = " 10えん と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!"
-h1 = "10えんと交換します!"
-elsif trade == "まぐろ" && g6 > 0
-g6 -= 1
-kekka = "まぐろ と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!"
-h1 = "まぐろと交換します!"
-end
-
-
-
-
-
-db.execute(goods, g1, g2, g3, g4, g5, g6, person)
-db.execute(upd, pt, person)
-
-
-pre = "%"
-printf(<<_EOS_, h1, name, pt, kekka, g1, g2, g4)
-
-<!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/tsuya.png"/>
-<title>こうかん!</title>
-<style type="text/css">
-<!--
--->
-</style>
-
-</head>
-
-<body>
-<header></header>
-<h1>さかたっち</h1>
-<h2>%s</h2>
-<p>
-%sさん<br>
-さかたポイント:%dp<br>
-%s
-</p>
-<table>
-<title>もっているチケット</title>
-<tr><td>
-オランダせんべい</td><td>:%d</td></tr><tr><td>
-温ビール</td><td>:%d</td></tr><tr><td>
-secret[3~/td><td>:%d</td></tr><tr><td>
-</td><td></td></tr><tr><td>
-</td><td></td></tr>
-</table>
-<br><br>
-<div class="f1"><a href="prof.rb"><div class="lets"><span>もどる!</span></div></a></div>
-<br><br>
-<form method="POST" action="gets.rb">
-<input type="text" name="trade" placeholder="ここは スタッフ の 人 が つかうよ!">
-<input type="submit" value="スタッフ ぼたん"><br>スタッフじゃない人はおさないでね!
-</form>
-
-<footer></footer>
-</body>
-</html>
-
-
-_EOS_
--- a/oasis2015/admin/#check.rb#	Thu Nov 05 11:02:08 2015 +0859
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-#!/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")
-
-getAC1 = ARGV[0]
-pass = "hogehogeboy"
-
-hsh = c["SQ1"]
-hsh += c["SQ2"]
-
-pts = "<table><tr><th>id</th><td>name</td><td>cal</td><td>age</td><td>sex</td><td>aria</td><td>exp</td><td>pt</td><td>lv</td></tr>"
-
-
-if c["SQ2"] == "toi"
-pts = "<table><tr><th>id</th><td>q1</td><td>q2</td><td>q3</td><td>q4</td><td>q5</td><td>q6</td><td>q7</td><td>q8</td><td>q9</td><td>secret</td></tr>"
-elsif c["SQ2"] == "time"
-pts = "<table><tr><th>cd</th><td>now</td><td>id</td></tr>"
-elsif c["SQ2"] == "goods"
-pts = "<table><tr><th>id</th><td>おちゃ</td><td>しょうひん2</td><td>しょうひん3</td><td>しょうひん4</td><td>しょうひん5</td><td>しょうひん6</td></tr>"
-elsif c["SQ2"] == "pass"
-pts = "<table><tr><th>id</th><td>pass</td><td>name</td></tr>"
-
-end
-
-
-######################################
-################SQ3###################
-if c["SQ3"] == ""
-else
-upd = c["SQ3"]
-db.execute(upd)
-end
-
-################SQ3###################
-######################################
-
-
-
-
-################################
-################################
-if hsh == ""
-#  pts = "hoge"
-  hsh = "select * from test"
-else
-end
-
-hsh2 = db.execute(hsh)
-i = 0
-while i < hsh2.length
-  data = hsh2[i]
-  if c["SQ2"] == "toi"
-    pts += "<tr><th>#{data[0]}</th><td>#{data[1]}</td><td>#{data[2]}</td><td>#{data[3]}</td><td>#{data[4]}</td><td>#{data[5]}</td><td>#{data[6]}</td><td>#{data[7]}</td><td>#{data[8]}</td><td>#{data[9]}</td><td>#{data[10]}</td></tr>" 
-  elsif c["SQ2"] == "time"
-    pts += "<tr><th>#{data[0]}</th><td>#{data[1]}</td><td>#{data[2]}</td></tr>"
-  elsif c["SQ2"] == "goods"
-    pts += "<tr><th>#{data[0]}</th><td>#{data[1]}</td><td>#{data[2]}</td><td>#{data[3]}</td><td>#{data[4]}</td><td>#{data[5]}</td><td>#{data[6]}</td></tr>"
-  else
-    pts += "<tr><th>#{data[0]}</th><td>#{data[1]}</td><td>#{data[2]}</td><td>#{data[3]}</td><td>#{data[4]}</td><td>#{data[5]}</td><td>#{data[6]}</td><td>#{data[7]}</td><td>#{data[8]}</td><td>#{data[9]}</td></tr>" 
-  end
-  i += 1
-end
-#end
-pts += "</table>"
-
-
-print"Content-type: text/html; charset=UTF-8\n\n"
-
-
-######################################
-################if ~html##############
-
-#if getAC1 == pass
-
-printf(<<_EOS_, pts, hsh2.lenght)
-<!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/tamago.png"/>
-
-<title>control</title>
-<style type="text/css">
-<!--
--->
-</style>
-</head>
-
-<body>
-<header><p>test,toi,goods,time,num,pass<p></header>
-
-
-
-<h1>control</h1>
-<form method="POST" action="check.rb?#{pass}">
-<input type="text" name="SQ1" value="select * from ">
-<input type="text" name="SQ2" placeholder='test JOIN pass ON test.id==pass.id;' value="test">
-<input type="submit">
-</form>
-
-<form method="POST" action="check.rb?#{pass}">
-<input type="text" name="SQ3" size="42" placeholder='insert into test values(501, "foo", "inu", 40, "G", "sakata", 0,0,1)' value="update test set pt = 0 where id = 0">
-<input type="submit">
-</form>
-<p>%s<br></p>
-
-
-<address>skip&#x40;xxxx.co.jp</address>
-<footer></footer>
-</body>
-</html>
-
-_EOS_
-#############################################
-#############################################
-#else
-if getAC1 == "hoge"    ###いらない行。accをつける前は"else"のみだった。
-printf(<<_EOS_)
-<!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/tamago.png"/>
-<title>さかたっち(go top!)</title>
-<style type="text/css">
-</style></head>
-<body><header></header>
-<h1>さかたっち</h1>
-<a href="../index.html">トップへ!</a>
-<address>skip&#x40;xxxx.co.jp</address>
-<footer></footer></body>
-</html>
-_EOS_
-end
--- a/opencampus2015/#battle.rb#	Thu Nov 05 11:02:08 2015 +0859
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-#!/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")
-
-per = "%"
-id = c.cookies["id"][0]
-person = id.to_i
-
-data = "select * from test where id = ?"
-cook = db.execute(data, person)
-printf("Content-type: text/html; charset=UTF-8\n\n")
-
-begin
-id,name,cal,age,sex,aria,exp,pt,lv = cook[0]
-rescue
-printf(<<_EOS_)
-<!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>Miyazac Quest</title>
-<style type="text/css">
-<!--
--->
-</style>
-</head>
-
-<body>
-<header></header>
-<h1>記録が無くなったようだ...</h1><h2>記憶も消してやりなおしたまえ......</h2>
-<div class="f1"><a href="index.html"><div class="lets"><span>新規記憶の作成</span></div></a></div>
-<div class="f1"><a href="cookie.rb"><div class="lets"><span>作成前に記憶を消す</span></div></a></div>
-<address>skip&#x40;xxxx.co.jp</address>
-<footer></footer>
-</body>
-</html>
-
-_EOS_
-exit(0)            ##プログラム終了! これがないと以降のプログラムが動いてしまう。
-end
-
-#################キャラクタ#########
-chenge = c["chenge"].to_i
-box = db.execute("select * from box where id = ?",id)
-hoge,no1,e1,t1,tm1,no2,e2,t2,tm2,no3,e3,t3,tm3=box[0]
-newname = "select name from zukan where no = ?"
-if chenge == 2
-  db.execute("update box set no1=?,e1=?,t1=?,tm1=?,no2=?,e2=?,t2=?,tm2=? where id = ?",no2,e2,t2,tm2,no1,e1,t1,tm1,id)
-calname = db.execute(newname,no2)[0][0]
-
-db.execute("update test set cal = ? where id = ?",calname,id)
-elsif chenge == 3
-  db.execute("update box set no1=?,e1=?,t1=?,tm1=?,no3=?,e3=?,t3=?,tm3=? where id = ?",no3,e3,t3,tm3,no1,e1,t1,tm1,id)
-calname = db.execute(newname,no3)[0][0]
-db.execute("update test set cal = ? where id = ?",calname,id)
-end
-
-##################################レベル処理する####
-gage = 0
-e1 = db.execute("select e1 from box where id = ?",person)[0][0]#じぶんのidのboxにある一体目の経験値
-no1 = db.execute("select no1 from box where id = ?",person)[0][0]
-no2 = db.execute("select no2 from box where id = ?",person)[0][0].to_i#2体目id
-no3 = db.execute("select no3 from box where id = ?",person)[0][0].to_i#3体目id
-lv2 = db.execute("select lv2 from zukan where no = ?",no1)[0][0].to_i
-lv3 = db.execute("select lv3 from zukan where no = ?",no1)[0][0].to_i
-lv4 = db.execute("select lv4 from zukan where no = ?",no1)[0][0].to_i
-lv5 = db.execute("select lv5 from zukan where no = ?",no1)[0][0].to_i
-if e1 < lv2
-lv = 1
-gage = 100-(e1/lv2.to_f*100)
-elsif e1 >= lv5
-lv = 5
-gage = 0
-elsif e1 >= lv4
-lv = 4
-gage = 100-(e1-lv4)/(lv5-lv4.to_f)*100
-elsif e1 >= lv3
-lv = 3
-gage = 100-(e1-lv3)/(lv4-lv3.to_f)*100
-elsif e1 >= lv2
-lv = 2
-gage = 100-(e1-lv2)/(lv3-lv2.to_f)*100
-end#########################################
-
-
-image = "./img/#{cal}#{lv}.png"
-alt = "#{cal}.png"
-
-
-
-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
-
-printf(<<_EOS_, per, gage, per, per, per, color, cal, image, alt, name, person, cal, lv)
-
-
-<!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>BATTLE!</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>%s</header>
-<h1>Miyazac Quest</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>
-
-<footer></footer>
-</body>
-</html>
-
-_EOS_

yatex.org