changeset 2541:46bfc4322e62

command
author ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp>
date Fri, 17 Jul 2015 15:43:40 +0900
parents 930db40a3a72
children 14088e38c6a0
files oasis2015/cookie.rb oasis2015/prof.rb oasis2015/retry.rb
diffstat 3 files changed, 77 insertions(+), 120 deletions(-) [+]
line wrap: on
line diff
--- a/oasis2015/cookie.rb	Fri Jul 17 14:58:40 2015 +0900
+++ b/oasis2015/cookie.rb	Fri Jul 17 15:43:40 2015 +0900
@@ -19,21 +19,13 @@
 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>
-
+<!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>さかたっち</h1>
--- a/oasis2015/prof.rb	Fri Jul 17 14:58:40 2015 +0900
+++ b/oasis2015/prof.rb	Fri Jul 17 15:43:40 2015 +0900
@@ -131,7 +131,7 @@
 end
 
 qrAC = qrc            ###生成したハッシュには、"乱数"=>"記号"が入っている
-getAC = ARGV[0].to_i  ###URL?以降の文字(特定の乱数)を取得
+getAC = ARGV[0].to_i  ###URL?以降の文字(特定の乱数)を取得してgetACに代入
 qr = qrAC[getAC]      ###特定の"乱数"が一致すると、"乱数"=>"記号"がqrに正しく入力される。
 if qr =="a" && q1 == 0
   q1 += 1
@@ -303,12 +303,85 @@
 
 
 
+
+########################
+###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
+#########################
+#########################
 ###################################--HTML--##################
 ###################################--------##################
 
 #以下のprintfについて
 #pre*4はstyleの部分、<h2>{margin(本来OS_,per,gage,per,per,per,name...)
-printf(<<_EOS_, per, gage, per, per, per, color, kkget, image, alt, name, person, cal, lv, pt, m1, mimg1, m2, mimg2, esa)
+printf(<<_EOS_, per, gage, per, per, per, color, kkget, image, alt, name, person, cal, lv, comm, pt, m1, mimg1, m2, mimg2, esa)
 
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
@@ -370,11 +443,7 @@
 <p class="gage">exp</p>
 </div>
 
-
-<form method="POST" action="prof.rb">
-<input type="text" name="bom" size="8">
-<input type="submit">
-</form>
+%s
 
 <p>さかたポイント:%dp</p>
 <table><tr><td>
--- a/oasis2015/retry.rb	Fri Jul 17 14:58:40 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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")
-
-
-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"]
-
-cle1 = "CREATE TABLE IF NOT EXISTS test(id, name, cal, age, sex, aria, 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)"
-
-ins4 = 'insert into time values(?, 61, "n")'
-ins5 = 'insert into num values("aa",0)'
-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)
-
-name = c["name"]
-namae = "#{name}"
-cal = c["cal"]
-age = c["age"]
-sex = c["sex"]
-aria = c["aria"]
-
-id = c.cookies["id"][0]
-if id == nil
-#  srand
-#  id = rand(1000)
-  number = db.execute(num, "aa")
-  id = number[0][0].to_i + 1
-  exp = 0
-  pt = 0
-  lv = 1
-  cd = "aa"
-  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)
-end
-  srand(id.to_i)  
-  id2 = rand(1000000)
-
-
-
-
-expires = 10
-
-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>さかたっち</h1>
-<h2>登録が完了しました!</h2>
-<p>ようこそ_ %s _さん!</p>
-<p>あなたのIDは%04dです。抽選はこのIDを元に行われます。</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"
-  `rm sql/main.sq3`
-#  `touch sql/main.sq3`
-#  `chmod a+w sql/main.sq3`
-end

yatex.org