Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 1697:bf44346154ec
プログラムの改良
author | houtin <c115080@g.koeki-u.ac.jp> |
---|---|
date | Thu, 27 Jul 2017 17:17:54 +0900 |
parents | 447138d8e338 |
children | 3dfd146b6bda |
files | event/oasis2017/quiz/#cookie.rb# event/oasis2017/quiz/#hutsu.rb# event/oasis2017/quiz/gassan.JPG |
diffstat | 3 files changed, 0 insertions(+), 241 deletions(-) [+] |
line wrap: on
line diff
--- a/event/oasis2017/quiz/#cookie.rb# Thu Jul 27 17:06:54 2017 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -#!/usr/bin/env ruby -# -*- coding: utf-8 -*- - -require 'yaml/store' -file = "db/point.yaml" - -require 'cgi' -c = CGI.new(:accept_charset => "UTF-8") - -# ≪祉鴻ф≪cookie絎臂緇 -# 吟cookiec.cookies[紊医][0] у -cookie_id=c.cookies["id"][0] - -# ≪祉鴻уュゃ緇 -form_name=c["playname"] # name若緇() -form_kwd=c["keyword"] # keyword緇() - - -if cookie_id == nil # (1)cookieid井域 - # 域id憜祉腱(to_i)絖(to_s)箙掩違腟水 - newid = Time.now.to_i.to_s + "/" + rand(99999).to_s - id=newid # 域idid -else # (2)cookieid違id - id=cookie_id -end - -# idcookieх御吟 -# 紊違24荐絎expire紊違ャ -expire = (Time.now+24*3600).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT") -printf("Content-type: text/html; charset=UTF-8\n") -printf("Set-Cookie: id=%s; expires=%s\n\n", id, expire) - -db = YAML::Store.new(file) -db.transaction do - info = db["info"] = db.fetch("info", Hash.new) - if !info[id] # 若倶宴脂(腥) - info[id] = Hash.new # 域激ャ蚊綵 - end - if form_name > "" # form荐絎 - info[id]["name"] = form_name # 若倶宴荐 - - -end \ No newline at end of file
--- a/event/oasis2017/quiz/#hutsu.rb# Thu Jul 27 17:06:54 2017 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -#!/usr/bin/env ruby -# -*- coding: utf-8 -*- - -require 'cgi' -c = CGI.new(:accept_charset => "UTF-8") - -require 'sqlite3' -file = "db/point.sq3" - -someVALUES4 = "qb1" -someVALUES5 = "qb2" -someVALUES6 = "qb3" - -#cookie≫ -cookie_id=c.cookies["id"][0] - -form_seikai=c["seikai"] #罩hВ?? -form_name=c["playname"] #ュ - -if cookie_id == nil - newid = Time.now.to_i.to_s + "/" + rand(99999).to_s - id = newid -else - id = cookie_id -end - -# idcookieх御吟 -# 紊違24荐絎expire紊違ャ -expire = (Time.now+24*3600).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT") -printf("Content-type: text/html; charset=UTF-8\n") -printf("Set-Cookie: id=%s; expires=%s\n\n", id, expire) - -db = SQLite3::Database.new(file) -db.execute("PRAGMA foreign_keys=on") -db.execute("CREATE TABLE IF NOT EXISTS " + - "users(id text primary key, name text, creation text)") -db.execute("CREATE TABLE IF NOT EXISTS " + - "point(id, keyword text, FOREIGN KEY(id) REFERENCES users(id),UNIQUE(id,keyword))") - - -if form_seikai > "" && id > ''# 罩hВ - db.execute("DELETE FROM point WHERE id=?", id) -end - -# cookie∫c障сc - -################################################################## 若句脂 -playname = form_name -if form_name > "" # 若name - now = Time.now.strftime("%F %T") - db.execute("REPLACE INTO users VALUES(?, ?, ?)", id, form_name, now); -else # 若namedb - dbn = db.execute("SELECT name from users WHERE id=?", id)[0] - if dbn != nil && dbn[0] - playname = dbn[0] # 若帥若鴻ゅ - end -end - -if playname == "" - print(<<-EOF) - <form action="#{File.basename($0)}" method="POST"> - <p>ゅャ: - <input type="text" name="playname"> - <input type="submit" valusomeVALUS1 = qa1 -e="篆"> - <input type="reset" value="祉"> - </form> - EOF - exit -end -printf("<h1>%sc潟</h1>\n", playname) -################################################################## - - - - -number = c["rd"] -img = c["img"] -def outinput(value, name) - printf("<label><input type=\"radio\" name=\"rd\" value=\"%s\">%s</label>", value, name) -end - - -if number == "" #莎桁 - number = "1" #number"1"篁e -end - -x = {"1" => ["<h1>膃筝<br></h1>", {"2" => "膂障羯<br>", "3" => "膤吾羯<br>", "4" => "筝羯<br>"}], - "2" => ["<h1>罩hВ鐚鐚鐚鐚<br></h1>", "<p>祉荀眼ゆс祉祉</p>"], - "3" => ["<h1>膃筝<br></h1>", {"2" => "膂障羯<br>", "3" => "膤吾羯<b\ -r>", "4" => "筝羯<br>"}], - "4" => ["<h1>膃筝<br></h1>", {"2" => "膂障羯<br>", "3" => "膤吾羯<b\ -r>", "4" => "筝羯<br>"}], - "5" => ["<h1>膃篋<br></h1>", {"6" => "筝羯<br>", "7" => "篋羯<br>", "8" => "筝羯<br>"}], - "6" => ["<h1>膃篋<br></h1>", {"6" => "筝羯<br>", "7" => "篋羯<br>", "8" => "筝羯<br>"}], - "7" => ["<h1>罩hВ鐚鐚鐚鐚<br></h1>", "<p>祉荀眼ゆс祉祉</p>"], - "8" => ["<h1>膃篋<br></h1>", {"6" => "筝羯<br>", "7" => "篋羯<br>", "8"=> "筝羯<br>"}], - "9" => ["<h1>膃筝<br></h1>", {"10" => "絽綵号絖<br>", "11" => "育絖<br>", "12" => "<br>"}], - "10" => ["<h1>罩hВ鐚鐚鐚鐚<br></h1>", "<p>祉荀眼ゆс祉祉</p>"], - "11" => ["<h1>膃筝<br></h1>", {"10" => "絽綵号絖<br>", "11" => "育絖<br>", "12" => "<br>"}], - "12" => ["<h1>膃筝<br></h1>", {"10" => "絽綵号絖<br>", "11" => "育絖<br>", "12" => "<br>"}], - "13" => [] -} - -print(<<-EOF) -<!DOCTYPE html> -<html lang="ja"> -<head><title> 泣ゃ</title> -<link rel="stylesheet" type="text/css" href="" > -<meta name="viewport" content="width=device-width,initial-scale=1"> -</head> -<body> - -EOF - - - - -print"<form method=\"POST\" action=\"./hutsu.rb\">\n" - -q = x[number] - -#ifу翫馹茵罩hВ筝罩hВ鐚筝罩hВ鐚鐚鐚 -if number == "1" || number == "5" || number == "9" # - printf("<p>%s</p>", q[0]) - if number == "1" - printf("<p><a href=\"tama.jpg\"><img src=\"tama_mini.jpg\" alt=\"tama\" height=\"300px\" width=\"300px\"></a></p>") - elsif number == "5" - printf("<p><a href=\"12.jpg\"><img src=\"12_mini.jpg\" alt=\"12\" height=\"300px\" width=\"300px\"></a></p>") - elsif number == "9" - printf("<p><a href=\"shishi.JPG\"><img src=\"shishi_mini.JPG\" alt=\"shishi\" height=\"333px\" width=\"500px\"></a></p>") - end - for v, sel in q[1] - outinput(v, sel) - end - print"<input name=\"ok\" type=\"submit\" value=\"篆\">\n" - print"<input name=\"ng\" type=\"reset\" value=\"祉\">\n" -elsif number == "2" || number == "7" || number == "10" #罩hВ - printf("%s", q[0]) - printf("%s", q[1]) - if number == "2" - print("<p>") - printf("<video controls wight=\"320\"height=\"240\"><source src=\"skipseikai1.mp4\"></video>") - print("<\p>") - printf("<label><input type=\"radio\" name=\"rd\" value=\"5\">罨<檎蚊<br></label>") - db.execute("REPLACE INTO point VALUES(?,?)",id,someVALUES4) - elsif number == "7" - print("<p>") - printf("<video controls wight=\"320\"height=\"240\"><source src=\"skipseikai4.mp4\"></video>") - print("<\p>") - printf("<label><input type=\"radio\" name=\"rd\" value=\"9\">罨<檎蚊<br></label>") - db.execute("REPLACE INTO point VALUES(?,?)",id,someVALUES5) - elsif number == "10" - print("<p>") - printf("<video controls wight=\"320\"height=\"240\"><source src=\"skipseikai5.mp4\"></video>") - print("<\p>") - printf("<label><input type=\"radio\" name=\"rd\" value=\"13\">罨<檎蚊<br></label>") - db.execute("REPLACE INTO point VALUES(?,?)",id,someVALUES6) - end - printf("<input type=\"submit\" value=\"罨<\">") - -elsif number == "3" || number == "6" || number == "11" #筝罩hВ1 - print("<h1>罧綽居筝綺若</h1>") - printf("<p>%s</p>", q[0]) - if number == "3" - printf("<p><a href=\"tama.jpg\"><img src=\"tama_mini.jpg\" alt=\"tama\" height=\"300px\" width=\"300px\"></a></p>") - elsif number == "6" - printf("<p><a href=\"12.jpg\"><img src=\"12_mini.jpg\" alt=\"12\" height=\"300px\" width=\"300px\"></a></p>") - elsif number == "11" - printf("<p><a href=\"shishi.JPG\"><img src=\"shishi_mini.JPG\" alt=\"shishi\" height=\"333px\" width=\"500px\"></a></p>") - end - for v, sel in q[1] - outinput(v, sel) - end - print"<input name=\"ok\" type=\"submit\" value=\"篆\">\n" - print"<input name=\"ng\" type=\"reset\" value=\"祉\">\n" -elsif number == "4" || number == "8" || number == "12" #筝罩hВ2 - print("<h1>鐚筝綺c帥若</h1>") - printf("<p>%s</p>", q[0]) - if number == "4" - printf("<p><a href=\"tama.jpg\"><img src=\"tama_mini.jpg\" alt=\"tama\" height=\"300px\" width=\"300px\"></a></p>") - elsif number == "8" - printf("<p><a href=\"12.jpg\"><img src=\"12_mini.jpg\" alt=\"12\" height=\"300px\" width=\"300px\"></a></p>") - elsif number == "12" - printf("<p><a href=\"shishi.JPG\"><img src=\"shishi_mini.JPG\" alt=\"shishi\" height=\"333px\" width=\"500px\"></a></p>") - end - for v, sel in q[1] - outinput(v, sel) - end - print"<input name=\"ok\" type=\"submit\" value=\"篆\">\n" - print"<input name=\"ng\" type=\"reset\" value=\"祉\">\n" -elsif number == "13" - print("<h1>腟肴;</h1>") -end -print"</form>\n" -print "</body>\n" -print "</html>\n" -