Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2796:e7d1c5b7102d
rm
author | ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp> |
---|---|
date | Fri, 20 Nov 2015 18:41:30 +0900 |
parents | 6f52a8245873 |
children | 5990250a795d |
files | opencampus2015/.htaccess opencampus2015/accountcheck.rb opencampus2015/admin/.htaccess opencampus2015/admin/.htpasswd opencampus2015/admin/check.rb opencampus2015/battle.rb opencampus2015/cookie.rb opencampus2015/gets.rb opencampus2015/gohan.rb opencampus2015/img/cabage.png opencampus2015/img/exp.png opencampus2015/img/expfront.png opencampus2015/img/fish.png opencampus2015/img/food.png opencampus2015/img/foot.png opencampus2015/img/foot2.png opencampus2015/img/head.png opencampus2015/img/head2.png opencampus2015/img/inazuma1.png opencampus2015/img/inazuma2.png opencampus2015/img/inazuma3.png opencampus2015/img/inazuma4.png opencampus2015/img/inazuma5.png opencampus2015/img/inu1.png opencampus2015/img/inu1o.png opencampus2015/img/inu2.png opencampus2015/img/inu2o.png opencampus2015/img/inu3.png opencampus2015/img/inu3o.png opencampus2015/img/inu4.png opencampus2015/img/inu4o.png opencampus2015/img/inu5.png opencampus2015/img/inu5o.png opencampus2015/img/ito1.png opencampus2015/img/ito2.png opencampus2015/img/ito3.png opencampus2015/img/ito4.png opencampus2015/img/ito5.png opencampus2015/img/kai.png opencampus2015/img/kamon1.png opencampus2015/img/kamon1o.png opencampus2015/img/kamon2.png opencampus2015/img/kamon2o.png opencampus2015/img/kamon3.png opencampus2015/img/kamon3o.png opencampus2015/img/kamon4.png opencampus2015/img/kamon4o.png opencampus2015/img/kamon5.png opencampus2015/img/kamon5o.png opencampus2015/img/kinoko1.png opencampus2015/img/kinoko2.png opencampus2015/img/kinoko3.png opencampus2015/img/kinoko4.png opencampus2015/img/kinoko5.png opencampus2015/img/kyabetsu.png opencampus2015/img/list.csv opencampus2015/img/lvb.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/niku.png opencampus2015/img/ninnjinn.png opencampus2015/img/pan.png opencampus2015/img/qr/Q1.pdf opencampus2015/img/qr/Q2.pdf opencampus2015/img/qr/Q3.pdf opencampus2015/img/qr/Q4.pdf opencampus2015/img/qr/Q5.pdf opencampus2015/img/qr/Qlogin.pdf opencampus2015/img/qr/qr1.png opencampus2015/img/qr/qr2.png opencampus2015/img/qr/qr3.png opencampus2015/img/qr/qr4.png opencampus2015/img/qr/qr5.png opencampus2015/img/qr/qrlogin.png opencampus2015/img/room.png opencampus2015/img/ship.png opencampus2015/img/snail.png opencampus2015/img/snake1.png opencampus2015/img/snake2.png opencampus2015/img/snake3.png opencampus2015/img/snake4.png opencampus2015/img/snake5.png opencampus2015/img/tako1.png opencampus2015/img/tako2.png opencampus2015/img/tako3.png opencampus2015/img/tako4.png opencampus2015/img/tako5.png opencampus2015/img/tamago.png opencampus2015/img/tsuya.png opencampus2015/index.html opencampus2015/list.csv opencampus2015/list2.csv opencampus2015/list3.csv opencampus2015/prof.rb opencampus2015/profeel.css opencampus2015/quest.rb opencampus2015/smart.css opencampus2015/sql/hoge |
diffstat | 105 files changed, 0 insertions(+), 1802 deletions(-) [+] |
line wrap: on
line diff
--- a/opencampus2015/.htaccess Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -AddHandler cgi-script .rb -AddType "text/html; charset=UTF-8" .rb -AddType "text/html; charset=UTF-8" .html -Options +ExecCGI
--- a/opencampus2015/accountcheck.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -#!/usr/bin/env ruby22 -# -*- coding: utf-8 -*- - -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(?, ?, ?, ?, ?, ?, ?, ?, ?)" - -toi = "insert into toi values (?, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)" -item = "insert into goods values (?, 0, 0, 0, 0, 0, 0)" - -name = c["name"] -pswd = c["pswd"] -cle1 = "CREATE TABLE IF NOT EXISTS test(id, name, cal, age, sex, pswd, exp, pt, lv)" -cle2 = "CREATE TABLE IF NOT EXISTS toi(id, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10)" -cle3 = "CREATE TABLE IF NOT EXISTS goods(id, g1, g2, g3, g4, g5, g6)" -cle4 = "CREATE TABLE IF NOT EXISTS time(cd, now, id)" -cle5 = "CREATE TABLE IF NOT EXISTS num(cd, id)" -cle6 = "CREATE TABLE IF NOT EXISTS pass(id, pass, name)" - -cle7 = "CREATE TABLE IF NOT EXISTS zukan(no, name, tah, lv2, lv3, lv4, lv5)" -cle8 = "CREATE TABLE IF NOT EXISTS box(id, no1, e1, t1, tm1, no2, e2, t2, tm2, no3, e3, t3, tm3)" -ins8 = "insert into box values(?,?,0,?,?,0,0,0,0,0,0,0,0)" - -ins4 = 'insert into time values(?, 61, "n")' -ins5 = 'insert into num values("aa",0)' -ins6 = 'insert into pass values(?, ?, ?)' -num = "select id from num where cd = ?" -numup = "update num set id = ? where cd = ?" - -db.execute(cle1) -db.execute(cle2) -#db.execute(cle3) -db.execute(cle4) -db.execute(cle5) -db.execute(cle6) -db.execute(cle7) -db.execute(cle8) -if name == "createman789789789" - ("a".."j").each{|x|db.execute(ins4,x)} - db.execute(ins5) - #system `sqlite3 -separator , /sql/main.sq3 ".import list.csv zukan"` #(ins7) - CSV.foreach(csv) do |row| - db.execute("INSERT INTO zukan VALUES(?,?,?,?,?,?,?)",*row) - end -end - -name = c["name"] -namae = "#{name}" -cal = c["cal"] -age = c["age"] -sex = c["sex"] -aria = c["aria"] - - -id = c.cookies["id"][0] -pass = c.cookies["pass"][0] -no1 = db.execute("select no from zukan where name = ?",cal)[0][0] -t1 = db.execute("select tah from zukan where name = ?",cal)[0][0] - - -if id == nil - number = db.execute(num, "aa") - begin - id = number[0][0].to_i + 1 - rescue - ("a".."j").each{|x| db.execute(ins4,x)} - # 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") - db.execute(ins5) - id = number[0][0].to_i + 1 - end - exp = 0 - pt = 0 - lv = 1 - cd = "aa" - if pass == nil - pass = id - end - db.execute(ins6, id, pass, name) - db.execute(sql, id, name, cal, age, sex, aria, exp, pt, lv) - db.execute(toi, id) - # db.execute(item, id) - db.execute(numup, id, cd) - db.execute(ins8,id,no1,t1.to_i/5,t1.to_i/5) -end -# srand(id.to_i) -# id2 = rand(1000000) -id2 = pass - - - -expires = "SUN, 5, MAR 2017 00:00:00 GMT" - -printf("Content-type: text/html; charset=UTF-8 -Set-Cookie:id=%s ;expires=%s -Set-Cookie:pass=%s ;expires=%s\n\n", id, expires, id2, expires) - -printf(<<_EOS_, name, id.to_i) -<!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>Registering Account</title> - -</head> -<body> -<h1>Miyazac Quest</h1> -<h2>登録完了!</h2> -<p>よくきた_ %s _よ!</p> -<p>おまえのIDは%04dだ!</p> -<div class="f1"><a href="prof.rb"><div class="lets"><span>始めよう!</span></div></a></div> -<form method="POST" type="text"> -</form> -</body></html> -_EOS_ -if name == "createman987987987" -filename ='sql/main.sq3' -File.delete filename -end
--- a/opencampus2015/admin/.htaccess Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -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
--- a/opencampus2015/admin/.htpasswd Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -c113007:QRf28ARYqd/FY
--- a/opencampus2015/admin/check.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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) -<!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?"> -<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> - -<footer></footer> -</body> -</html> - -_EOS_ -############################################# -############################################# -#else
--- a/opencampus2015/battle.rb Fri Nov 20 18:36:17 2015 +0900 +++ /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@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_
--- a/opencampus2015/cookie.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#!/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] -id = nil -expires = Time.now + 1 -if id == nil -end - - -printf("Content-type: text/html; charset=UTF-8 -Set-Cookie:id=%s ;expires=%s\n\n", id, expires) - -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>Registering Account</title> -</head> -<body> -<h1>Miyazac Quest</h1> -<h2>記憶は消えた...</h2> - -<div class="f1"><div class="lets"> -<a href="index.html">新しい記録を作成</a></div></div> -</body></html> -_EOS_
--- a/opencampus2015/gets.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +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] - -srand -x = rand(3) #0~2の変動 - -gets = c["sho"] -n1 = "おかし" #商品それぞれの名前 -c1 = 4 + x #商品それぞれに対して消費するポイント -n2 = "ジュース" -c2 = 10 -n3 = "入学権" -c3 = 30000000 -n4 = "" -c4 = 2 -n5 = "" -c5 = 5 -n6 = "" -c6 = 100 - - -h1 = "チケットを発行したよ!<br>205教室のスタッフの人と商品をこうかんしてね!" -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 = "#{n4}交換券をゲット!" -elsif gets == "s5" && pt >= c5 - g5 += 1 - pt -= c5 - kekka = "#{n5}をゲット!" -elsif gets == "s6" && pt >= c6 - g6 += 1 - pt -= c6 - kekka = "#{n6}交換券をゲット!" -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 = "#{n4} と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!" - h1 = "#{n4}と交換します!" -elsif trade == n5 && g5 > 0 -g5 -= 1 - kekka = "#{n5}と交換します!<br>スタッフの人は、スタッフがボタンを押した場合のみ、交換してください!" -h1 = "10えんと交換します!" -elsif trade == n6 && g6 > 0 -g6 -= 1 - kekka = "#{n6}と交換します!<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, 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>secret</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/opencampus2015/gohan.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +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") - -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 = "%" -##################################### -##########秘密のこたえを設定############## -if cal == "inu" -m3 = "あゆ" -elsif cal == "sisip" -m3 = "ゆめ" -elsif cal == "kamon" -m3 = "ねぎ" -elsif cal == "boy" -m3 = "ふね" -elsif cal == "girl" -m3 = "かんざし" -else -m3 = "skipskip" -end -##################################### -##################################### - - -gohan = c["gohan"] -#himitu = "" -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_
--- a/opencampus2015/img/list.csv Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -inu1 -inu2 -inu3 -inu4 -inu5
--- a/opencampus2015/index.html Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -<!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>opencampus2015-7</title> - -</head> - -<body> -<h1>Miyazac Quest</h1><h2>~魔王駿を倒せ~</h2> -<p>ユーザ登録</p> - -<form method="POST" action="./accountcheck.rb"> -<table> -<tr><td>名前</td><td><input name="name" type="text" size="15" placeholder="名前"></td></tr> -<tr><td>パスワード</td><td><input name="pswd" type="text" size="15" placeholder="0000"></td></tr> -<tr><td>性別</td><td><select name="sex"> - <option value="B">男 - <option value="G">女 - </select></td></tr> -<tr><td>年代</td><td><select name="age"> - <option>10代以下 - <option>10代 - <option>20代 - <option>30代 - <option>40代 - <option>50代 - <option>60代以上 - </select></td></tr> -<tr><td>キャラ</td><td><select name="cal"> - <option value="snake">スネーク - <option value="kamon">カモン - <option value="medama">目玉 - </select></td></tr> -<tr><td></td><td><input type="submit" value="登録する!"></td></tr> -</table> -</form> -</body> -</html>
--- a/opencampus2015/list.csv Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -1,inazuma,30,20,50,90,120 -2,inu,25,16,30,50,70 -3,ito,10,6,12,18,24 -4,kamon,20,20,30,40,50 -5,kinoko,10,4,10,20,30 -6,medama,20,30,34,42,48 -7,momen,15,10,20,30,40 -8,snake,25,6,20,40,80 -9,tako,20,10,26,36,46
--- a/opencampus2015/list2.csv Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -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/list3.csv Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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
--- a/opencampus2015/prof.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,380 +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") - -id = c.cookies["id"][0] -person = id.to_i - -data = "select * from test where id = ?" -data2 = "select * from test where id = ?" -#idが?(後で代入)のデータをtest票から探す。という命令をdataにしくむ。全てがほしい場合は「*」。「*」を「name」に変えると該当データのnameだけとりだす。 -cook = db.execute(data, person) #dataに仕組んでいた命令を、personを代入しつつ実行。 -cook2 = db.execute(data2, person) -jikan1 = "select * from time where cd = ?" -timeupd = "update time set now = ?, id = ? where cd = ?" - -que = "select * from toi where id = ?" -queupd = "update toi set q1 = ?, q2 = ?, q3 = ?, q4 = ?, q5 = ? where id = ?" -toi = db.execute(que, person) - -bomd = "update test set pt = ? where id = ?" -ins4 = 'insert into time values(?, 61, "n")' -printf("Content-type: text/html; charset=UTF-8\n\n") - -begin -name = cook[0][1] -cal = cook[0][2] -age = cook[0][3] -sex = cook[0][4] -aria = cook[0][5] -exp = cook[0][6] -pt = cook[0][7] -#lv = cook[0][8] -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@xxxx.co.jp</address> -<footer></footer> -</body> -</html> - -_EOS_ -exit(0) ##プログラム終了! これがないと以降のプログラムが動いてしまう。 -end - - - -q1 = toi[0][1] -q2 = toi[0][2] -q3 = toi[0][3] -q4 = toi[0][4] -q5 = toi[0][5] - -per ="%" - -##################--ptを獲得するための乱数生成--############# -##################----############################# - -def qrc() - srand(4567845678) - x = rand(10000000) - srand(x) - qrnumber = Hash.new("n") - qrarr = ["a", "b", "c", "d", "e"] - qrarr.length.times do |i| - qrnumber[rand(100000000)] = qrarr[i] - end - return qrnumber -end - -##################ptを獲得した際の反応。#################### -#########前の人が書き込んだ時間と比べて60秒以内なら追加ポイント#### -kpt = 0 - - -begin - jikan2 = db.execute(jikan1, "j") - now1 = jikan2[0][1] -rescue - ("a".."j").each{|x| db.execute(ins4,x)} -end - - -qrAC = qrc ###生成したハッシュには、"乱数"=>"記号"が入っている -getAC = ARGV[0].to_i ###URL?以降の文字(特定の乱数)を取得してgetACに代入 -qr = qrAC[getAC] ###特定の"乱数"が一致すると、"乱数"=>"記号"がqrに正しく入力される。 -if qr =="a" && q1 == 0 - q1 += 1 - jikan2 = db.execute(jikan1, "a") - now1 = jikan2[0][1] - nowper = jikan2[0][2] - now2 = Time.now.to_i - db.execute(timeupd, now2, person, "a") - if person == nowper - elsif now1 == nil - elsif now2-now1 < 40 - pt += 5 - kpt += 5 - end - pt += 7 - kpt += 7 -elsif qr == "b" && q2 == 0 - q2 += 1 - jikan2 = db.execute(jikan1, "b") - now1 = jikan2[0][1] - nowper = jikan2[0][2] - now2 = Time.now.to_i - db.execute(timeupd, now2, person, "b") - if person == nowper - elsif now1 == nil - elsif now2-now1 < 20 - pt += 2 - kpt += 2 - end - pt += 12 - kpt += 12 -elsif qr == "c" && q3 == 0 - q3 += 1 - jikan2 = db.execute(jikan1, "c") - now1 = jikan2[0][1] - nowper = jikan2[0][2] - now2 = Time.now.to_i - db.execute(timeupd, now2, person, "c") - if person == nowper - elsif now1 == nil - elsif now2-now1 < 25 - pt += 10 - kpt += 10 - end - pt += 3 - kpt += 3 -elsif qr == "d" && q4 == 0 - q4 += 1 - jikan2 = db.execute(jikan1, "d") - now1 = jikan2[0][1] - nowper = jikan2[0][2] - now2 = Time.now.to_i - db.execute(timeupd, now2, person, "d") - if person == nowper - elsif now1 == nil - elsif now2-now1 < 60 - pt += 2 - kpt += 2 - end - pt += 15 - kpt += 15 -elsif qr == "e" && q5 == 0 - q5 += 1 - jikan2 = db.execute(jikan1, "e") - now1 = jikan2[0][1] - nowper = jikan2[0][2] - now2 = Time.now.to_i - db.execute(timeupd, now2, person, "e") - if person == nowper - elsif now1 == nil - elsif now2-now1 < 50 - pt += 4 - kpt += 4 - end - pt += 10 - kpt += 10 -end - - -db.execute(bomd, pt, person) -db.execute(queupd, q1, q2, q3, q4, q5, person) - -kkget = "" - -########################~ここまでpt処理~################### -####################################################### - -##################################レベル処理する#### -lv = 1 -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 -#expが10あがる毎にlvが1あがる。 -#expの1の位*10で、次のレベルアップに必要な経験値の割合が出る。 -#(exp=12の場合、2*10=『20%』、次のレベルアップまであと80%が必要、と分かる。) -#(exp=35の場合、5*10=『50%』、次のレベルアップまであと50%が必要、と分かる。) -#exppoint = "select e1 from box where id = ?" #じぶんのidのboxにある一体目の経験値 -#expp = db.execute(exppoint,id) -#exp = expp[0][0].to_i -#gage = 0 -#gage2 = db.execute("select no1 from box where id = ?",id) -#exp2 = exp -#esa = "<br><br><br>" - -wcname ="select name from zukan where no = ?" -cal1 = db.execute(wcname,no1)[0][0] -begin -cal2 = db.execute(wcname,no2.to_s)[0][0] -rescue -cal2 = db.execute(wcname,no2.to_s)[0] -end -begin -cal3 = db.execute(wcname,no3.to_s)[0][0] -rescue -cal3 = db.execute(wcname,no3.to_s)[0] -end -chengeform = '<select name="chenge"><option value = 0>' + "#{cal1}" -if no2 > 0 && no3 >0 - chengeform +="<option value = 2>#{cal2}<option value = 3>#{cal3}" -elsif no2 > 0 && no3 > 0 - chengeform +="<option value = 2>#{cal2}" -end - -kakunin = "" -######################### -######################### -###################################--HTML--################## -###################################--------################## - -printf(<<_EOS_, per, gage, per, per, per, color, kakunin, kkget, image, alt, name, person, cal, lv, chengeform,pt,chengeform) - - -<!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"> -<!-- -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><p>%s</p></header> -<h1>Miyazac Quest</h1> -<h2>%s</h2> - -<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> - -<form method="POST" action="quest.rb"> -%s -<input type="submit" value="~魔王の迷宮へ~"> -</form> -<p>coin:%d$</p> -<table class="anime"><tr><td> - -<form method="POST" action="prof.rb"> -<label><input type="checkbox" name="hdn">宿屋<div><br> -<label><input type="radio" name="yado" value="g1">馬小屋:10$<img src="./img/food.png" width="16" height="16"></label><br> -<label><input type="radio" name="yado" value="g2">客室:50$<img src="./img/niku.png" width="16" height="16"></label><br><br> -<input type="reset" value="やめる"> -<input type="submit" value="泊まる"></div></label> -</form> -</td><td> -<form method="POST" action="battle.rb"> -<label><input type="checkbox" name="hdn">闘技場<div><br><br><br> -<label>%s</label> -<label><input type="submit" value="バトル"></label><br> -<label><input type="reset" value="いかない"></label></div></label> -<!--</div></label>--> -</form> -</td><td> - -<form method="POST" action="cookie.rb"> -<label><input type="checkbox" name="hdn">人生リセット<div><br><br><br> -<input type="reset" value="やめる"> -<input type="submit" value="記憶を消す"></div></label> -</form> -</td></tr></table> -<footer></footer> -</body> -</html> - -_EOS_
--- a/opencampus2015/profeel.css Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -body{text-align:center; -background:#355; -border:dashed 5px navy; -} -header{ -#padding:100px; - position: relative; - top: -16px; - left: 0px; - width: 100%; - height: 200px; -background-image:url(./img/head.png); -text-align:center; -margin-left:auto;margin-right:auto; -} -footer{ -#padding:100px; - position: relative; - top: 0px; - left: 0px; - width: 100%; - height: 200px; -background-image:url(./img/foot.png); -text-align:center; -margin-left:auto;margin-right:auto; -} - - - -header p {color:red;} - -h1{ -color:#0d4; -border:solid 5px #a00; -border-style:double; -background:url("./img/lvb.png"); -background-color:red; -} - - - - -input[type="checkbox"][name="hdn"] + span {display: none;} -input[type="checkbox"][name="hdn"]:checked + span {display: inline;} - -input[type="checkbox"][name="hdn"] + div{opacity: 0;} -input[type="checkbox"][name="hdn"]:checked + div { - opacity: 1.0; transition: 3s ease-in-out; - transition: 1s linear;} - -table{margin-left:auto; margin-right: auto;} -table.state{text-align:left;} -table.state tr+tr+tr+tr{font-size:xx-large;} -#table.anime td{border:solid red;} - -div.f1{padding:0% 0%; -margin:1em 17em;} -div.lets{ -border:solid 2px #fa0; -background:#aaa; -padding:1% 0%; -#margin:1em 17em; -} -div.lets span{color:navy; text-decoration: underline #faf;} - -div.cal {margin-left:auto; margin-right:auto; -width: 320px; height: 180px; -background: #eef; -border: solid 2px navy;} - -div.calque {margin-left:auto; margin-right:auto; -width: 180px; height: 180px; -background: #eef; -border: solid 2px navy;} - -
--- a/opencampus2015/quest.rb Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -#!/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 -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 - - - - cmps = c["cmps"] -x = 0 -per ="%" -newone = "" - -data = "select * from test where id = ?" -cook = db.execute(data, id) -begin -cal = cook[0][2] -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@xxxx.co.jp</address> -<footer></footer> -</body> -</html> - -_EOS_ -exit(0) ##プログラム終了! これがないと以降のプログラムが動いてしまう。 -end -################################## -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 -srand -if cmps == "↑" - exp += 2 - x = rand(2)+1 -elsif cmps == "→" - exp += 1 - x = rand(3)+1 -#################### -elsif cmps == "←" ##当たりルート - no1 = db.execute("select no1 from box where id = ?",id)[0][0] - no2 = db.execute("select no2 from box where id = ?",id)[0][0] - no3 = db.execute("select no3 from box where id = ?",id)[0][0] - number = rand(8)+1 -while number == no1.to_i - number = rand(8)+1 -end -##############2 - if no2 == 0 - newcal = db.execute('select * from zukan where no = ?',"#{number}") - no2 = newcal[0][0] - calname = newcal[0][1] - t2 = newcal[0][2].to_i/5 - db.execute("update box set no2 = ?, t2 = ?, tm2 = ? where id = ?",no2,t2,t2,id) - newone = "#{calname}が現われた!<br>#{calname}が仲間になった!" -##############3 - elsif no3 == 0 - while number == no1.to_i || number == no2.to_i - number = rand(8)+1 - end - newcal = db.execute('select * from zukan where no = ?',"#{number}") - no3 = newcal[0][0] - calname = newcal[0][1] - t3 = newcal[0][2].to_i/5 - db.execute("update box set no3 = ?, t3 = ?, tm3 = ? where id = ?",no3,t3,t3,id) - newone = "#{calname}が現われた!<br>#{calname}が仲間になった!" -############## - else - x = 49 - end -end -db.execute(expup,exp,id) -coin = db.execute("select pt from test where id = ?",id)[0][0] -coin += x -db.execute("update test set pt = ?",coin) -############################################ - - -if x > 0 - xs = x.to_s + "$get!" -else - xs = "" -end - -x = rand(30) -if x == 0 -cmpsget ='<input type="submit" name="cmps" value="←"> -<input type="submit" name="cmps" value="↑"> -<input type="submit" name="cmps" value="→">' -elsif x == 1 -cmpsget ='<input type="submit" name="cmps" value="←"> -<input type="submit" name="cmps" value="↑" disabled> -<input type="submit" name="cmps" value="→">' -else -cmpsget ='<input type="submit" name="cmps" value="←" disabled> -<input type="submit" name="cmps" value="↑"> -<input type="submit" name="cmps" value="→">' -end - -lv = 1 -gage = 0 -e1 = db.execute("select e1 from box where id = ?",id)[0][0]#じぶんのidのboxにある一体目の経験値 -no1 = db.execute("select no1 from box where id = ?",id)[0][0] -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 - - -################################################## -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 - -image = "./img/#{cal}#{lv}.png" -alt = "#{cal}.png" - - -printf(<<_EOS_,per,gage,per,per,per,color,cmps,xs,newone,image,alt,cmpsget) - - -<!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"> -<!-- -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.calque div{float:center; border:solid %s;} - ---> -</style> -</head> - -<body> -<h1>だぁんじょん%s</h1> -<p>%s %s</p> -<div class="calque"> -<div> -<img src=%s alt=%s width="172" height="172"> -</div> -</div> - -<div class="gage"> -<p class="gage">exp</p> -</div> - -<form method="POST" action="quest.rb"> -%s -</form> -<div class="f1"> -<div class="lets"> -<a href="prof.rb">出る...</a> -</div></div> -<footer></footer> -</body> -</html> - -_EOS_
--- a/opencampus2015/smart.css Fri Nov 20 18:36:17 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -body{text-align:center; -background:#bff; -border:dashed 5px navy; -margin-left:auto;margin-right:auto; -width:340px; -} -header{ -#padding:100px; - position: relative; - top: 0px; - left: 0px; - width: 100%; - height: 140px; -background-image:url(./img/head2.png); -background-repeat:no-repeat; -text-align:center; -margin-left:auto;margin-right:auto; -} -footer{ -#padding:100px; - position: relative; - top: 0px; - left: 0px; - width: 100%; - height: 140px; -background-image:url(./img/foot2.png); -background-repeat:no-repeat; -text-align:center; -margin-left:auto;margin-right:auto; -} - - - -header p {color:red;} - -h1{ -color:#e90; -border:solid 5px #fa0; -border-style:double; -background:url("./img/lvb.png"); -background-color:red; -} - -input[type="checkbox"][name="hdn"] + span {display: none;} -input[type="checkbox"][name="hdn"]:checked + span {display: inline;} - -input[type="checkbox"][name="hdn"] + div{opacity: 0;} -input[type="checkbox"][name="hdn"]:checked + div { - opacity: 1.0; transition: 3s ease-in-out; - transition: 1s linear;} - -table{margin-left:auto; margin-right: auto;} -table.state{text-align:left;} -table.state tr+tr+tr+tr{font-size:xx-large;} - - -div.f1{padding:0% 0%;} -div.lets{ -border:solid 2px #fa0; -background:#faf; -padding:1% 0%; -#margin:1em 17em; -} -div.lets span{color:navy; text-decoration: underline #faf;} - - - - -div.cal {margin-left:auto; margin-right:auto; -width: 320px; height: 180px; -background: #eef -border: solid 2px navy;} - - - -#form{margin-left:auto; margin-right:auto;}