Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2348:61bcdb86b026
Added 2014OC dir
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/.htaccess Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,4 @@ +AddHandler cgi-script .rb +AddType "text/html; charset=UTF-8" .rb +AddType "text/html; charset=UTF-8" .html +Options +ExecCGI
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/Bingo.css Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,76 @@ +html,body { + width: 100%; + height: 100%; +} +div.outflam{ + width: 800px; + height: 1240px; + margin-left: auto; + margin-right: auto; + padding: 0 auto; + } + +div.top{ + background: #136cf9; + background-image: url("png/top.png"); + background-repeat: no-repeat; + border: thin solid #136cf9; + width: 100%; + height: 180px; + margin-top:0 auto; + margin-bottom:0 auto; + margin-left: auto; + margin-right: auto; + +} + +p,h3 { + margin:0; + padding-left: 5%; + font-weight: 900; + height: 5%; + width: 95%; + border: thin solid #136cf9; +} + +div.center{ + border: thin solid #1d38ff; + background: #1d38ff; + width: 100%; + height: 45%; + margin-left: auto; + margin-right: auto; +} + +table { + background: white; + margin-left: auto; + margin-right: auto; + margin-top: 1%; + margin-bottom: auto; +} + +div.bottom{ + background: #45e2fe; + background-image: url("png/bottom.png"); + background-repeat: no-repeat; + background-position: center bottom; + border:thin solid #45e2fe; + width: 100%; + height: 150px; + margin-left: auto; + margin-right: auto; +} + +div.bottom img { + float: left; + margin-left: 15%; +} + +div.charSTATUS { + clear: right; + margin-top: 7%; + background: rgba(255,255,255,0.75); + width: 70%; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/Bingo.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,436 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +require 'sqlite3' +require 'cgi' +require 'date' +require './sub.rb' +require 'net/http' + +c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") +db = SQLite3::Database.new("sql/test.sq3") + +id = c.cookies["id"][0].to_i +magic = c.cookies["magic"][0].to_i +err = 0 # 不正な動きであれば負の値になる +sidesize = 3 +message = "はりきって行きましょう!<br>" # ビンゴ用テキスト + +print("Content-type: text/html; charset=UTF-8 \n\n") + +getcom = ARGV[0] + +### DELETE TABLE ### + +del = 'DELETE FROM main WHERE id=?' +if getcom == 'ududlrlrba' + db.execute(del, id) +end + +###### + +##### CHECKING UID ##### + +sql = "SELECT stamp_status, stamp_img, name, job, sex, exp FROM main WHERE id=? AND magic=?" +begin + user_data = db.execute(sql, id, magic) +rescue + user_data = [] +end + +if user_data == [] # ログインエラー(-1) + err -= 1 +end + +### LOGIN ERROR HTML ### + +if err == -1 + print' +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="refresh" content="2.5;http://skip.koeki-prj.org/minato2014/account.html"> +</head> +<title>たいとる</title> +<body> +' +print' +<p> ログインに失敗しました。 </p> +<p> +アカウント登録ページへ接続中…<br> +* 3秒経っても移動しない場合は<a href="account.html">こちら</a>から移動して下さい。 +</p> +</body> +</html> +' + exit +end + +###### + +########## + +##### RE-ARRAYING STAMP_STATUS AND STAMP_IMG ##### + +# stamp status +stamp_st = user_data[0][0] +stamp_st = stamp_st.split(//) # 一文字ずつ分けて配列にする +stamp_st = stamp_st.map {|s| s.to_i} # 配列内の文字列を数列になおす + +# stamp img +stamp_img = user_data[0][1] +stamp_img = stamp_img.split(",") # 文字列を","で区切って配列にする + +########## + +##### STAMPPING ##### + +### Making randam number ### + +def taiou(sidesize) + srand(123456789) + stamp = Hash.new("n") + stamp_name = ["kamo", "ko", "eki", "bun", "ka", "dai", "gaku", "to", "hoku"] + (sidesize**2).times do |n| + stamp[rand(10000000)] = stamp_name[n] + end + stamp +end + +###### + +##### Checking bingo method ##### + +def bingocheck(start, sidesize, stepon, stamp, decision, bingo) + nbox = [] + setbox = Hash.new + if sidesize == stepon + x = sidesize + else + x = 1 + end + x.times do |m| + start.step(sidesize*sidesize - 1, stepon) do |n| + nbox << n + m + if nbox.length == sidesize + dbox = Array.new(0) # next bingo or reach numbers(bingoed -> nothing) + for i in nbox + if stamp[i] == 0 + dbox << i + end + end + # sidesizeにdecisionの値を加えることで、ビンゴ、次ビンゴ、リーチをそれぞれdecisionに0,1,2を加えることで表現。 + if dbox.length == decision + setbox[dbox] = nbox + bingo << setbox + setbox = Hash.new + nbox = [] + else + nbox = [] + end + end + end + end +end +# bingo[{[ビンゴまたはリーチに必要な番号] => [ビンゴまたはリーチのラインを形成する番号]}] +########## + +### Checking Access Cord(AC) ### + +getAC = ARGV[0].to_i # URL?以降の引数を取得 +rightAC = taiou(sidesize) # taiouで生成したACのハッシュ +#p rightAC +rightAC = rightAC[getAC] # ACが正しければスタンプ名が入り、異なる場合はn + +##### ACCESS LOG ##### +t = Time.now +time = (t.hour * 3600) + (t.min * 60) + t.sec + +## Checking sql_master table. If sqlite_master don't have tablename, it create. + +sql_master = "SELECT name FROM sqlite_master WHERE name='logs';" +check_master = db.execute(sql_master) +sql_logs = 'CREATE TABLE logs( +id INTEGER PRIMARY KEY AUTOINCREMENT, +uid INTEGER, +ac TEXT, +time INTEGER); +' +if check_master == [] + db.execute(sql_logs) +end + +########## + +begin + get_log = 'SELECT ac, time FROM logs WHERE uid=(SELECT MAX(id) FROM logs WHERE uid=?);' # ユーザーの最新のログ情報を取得 + log_check = db.execute(get_log, id) +rescue + print'GETTING LOG ERROR!' +end +begin + log = 'INSERT INTO logs(uid, ac, time) VALUES(?, ?, ?)' + db.execute(log, id, rightAC, time) +rescue + print'INSERT LOG ERROR!' +end +# /* memo: 再度同じようなシステムを作る際はスタンプ用のテーブルがほしい。 */ # + +########## + +### ビンゴしたラインを判定(decision = 0) ### +bingo = [] +# 横 +bingocheck(0, sidesize, 1, stamp_st, 0, bingo) +# 縦 +bingocheck(0, sidesize, sidesize, stamp_st, 0, bingo) +# 左斜め +bingocheck(0, sidesize, sidesize+1, stamp_st, 0, bingo) +# 右斜め +bingocheck(sidesize-1, sidesize, sidesize-1, stamp_st, 0, bingo) +####### + +bingo = bingo.length # ビンゴの数 +last_bingo = bingo + +if rightAC != "n" # rightACが正しければ + + ### Update Stamp_status And Stamp_img ### + + # Replacing Image # + + index_st = [] + stamp_st.length.times { |c| + if stamp_st[c] == 0 + index_st << c + end + } + + ### リーチ(decision = 1)# [{[ビンゴの番号] => [リーチを構成する数]}] + reach = [] + # 横 + bingocheck(0, sidesize, 1, stamp_st, 1, reach) + # 縦 + bingocheck(0, sidesize, sidesize, stamp_st, 1, reach) + # 左斜め + bingocheck(0, sidesize, sidesize+1, stamp_st, 1, reach) + # 右斜め + bingocheck(sidesize-1, sidesize, sidesize-1, stamp_st, 1, reach) + ####### + + begin + reach = reach[0].flatten(2)[0] # ビンゴの番号のみ抽出 + rescue + reach = [] + end + + ### ビンゴしたラインを判定(decision = 0) ### + bingo = [] + # 横 + bingocheck(0, sidesize, 1, stamp_st, 0, bingo) + # 縦 + bingocheck(0, sidesize, sidesize, stamp_st, 0, bingo) + # 左斜め + bingocheck(0, sidesize, sidesize+1, stamp_st, 0, bingo) + # 右斜め + bingocheck(sidesize-1, sidesize, sidesize-1, stamp_st, 0, bingo) + ####### + + bingo = bingo.length # ビンゴの数 + + # Updating stamp_st # + if stamp_img.include?(rightAC) == true # 既に同名のスタンプが入っていたら + if stamp_st[stamp_img.index(rightAC)] < 9 + stamp_st[stamp_img.index(rightAC)] += 1 # 対応するスタンプの位置に1足す + message = "スタンプカウントが「1」増えました!(スタンプカウントは「9」が上限です)" + else + message="スタンプカウントMAX!!(※これ以上このスタンプのカウントは増えません)" + end + else + if reach != [] && bingo == 0 # はじめのビンゴは必ず3回で完成 + stamp_st[reach] += 1# ビンゴになる数字を代入 + stamp_img[reach] = rightAC + message = "新しいスタンプをGETしました!" # Top message + else + randam_number = index_st[rand(index_st.length)] # スタンプの入っていない個所のなかからランダムにひとつ選ぶ + stamp_st[randam_number] += 1 # 選ばれた個所に1足す + stamp_img[randam_number] = rightAC # stamp_stと同じ個所にstamp_imgにスタンプの名前を代入 + message = "新しいスタンプをGETしました!" # Top message + end + end + ## + + ### ビンゴしたラインを判定(decision = 0) ### + bingo = [] + # 横 + bingocheck(0, sidesize, 1, stamp_st, 0, bingo) + # 縦 + bingocheck(0, sidesize, sidesize, stamp_st, 0, bingo) + # 左斜め + bingocheck(0, sidesize, sidesize+1, stamp_st, 0, bingo) + # 右斜め + bingocheck(sidesize-1, sidesize, sidesize-1, stamp_st, 0, bingo) + ####### + + bingo = bingo.length # ビンゴの数 + + + ## + + # Convert to string # + + stamp_st_string = stamp_st.join + stamp_img_string = stamp_img.join(",") + + ## + + sql_update = "UPDATE main SET stamp_status=?, stamp_img=? WHERE id=?;" + db.execute(sql_update, stamp_st_string, stamp_img_string, id) +end + +###### + +########## + +##### HTML ##### +print' +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>たいとる</title> +<link rel="stylesheet" type="text/css" href="Bingo.css"> +</head> +<body> +' +### TOP ### + +sql_rank = 'select rank from main where id=?;' +rank = db.execute(sql_rank, id).flatten(2)[0].to_i + +print' +<div class="outflam"> +' +if rank > 0 + print'<div class="top" style="background: red;">' +else + print'<div class="top">' +end +# - ビンゴステータス処理 - # + +if rank > 0 + printf("<h1>おめでとうございます!!<br>☆ %d等 ☆が当選しました!!</h1>", rank) + # print'<p>抽選は終了しましたが、引続きゆる☆スタをお楽しみ下さい!!</p>' +end + +# End of top +print' +</div> +' +# Top message # + +bc = bingo.to_i - last_bingo.to_i + +if bc > 0 + message += '<br>おめでとう!' + bc.to_s + message += 'ビンゴ揃いました!!<br>' +end + +if rank > 0 + printf("<p style=\"background:red; color:white;\">%sおめでとうございます!☆ %d等 ☆が当選しました!!</p>", message, rank) +else + printf("<p style=\"background:#136cf9;\">%s</p>", message) +end + +## + +###### + +### CENTER ### +print' +<div class="center"> +<table border=1> +' +for i in 0..2 + print'<tr>' + 3.times do |n| + if stamp_st[3*i+n].to_i > 0 + printf("<td width=170 height=170><img src=\"png/%s.png\" alt=\"stamped\" width=\"160\" height=\"160\"><span style=\"color: green; font-weight: 900;\">%d</span></td>\n", stamp_img[3*i+n], stamp_st[3*i+n]) + else + print"<td width=170 height=170></td>\n" + end + end + print'<tr>' +end +# End of center +print' +</table> +</div> +' +###### + +### BOTTOM ### +print' +<div class="bottom"> +' +# - RPGの表示 - # + +name = user_data[0][2] +job = user_data[0][3] +sex = user_data[0][4] +exp = user_data[0][5] + +## GETTING EXP SUM ## + +sum_sql = 'SELECT SUM(exp) FROM main WHERE rank=0;' +sumexp = db.execute(sum_sql).flatten(2)[0] + +#### + +stamp = stamp_st.inject(:+) # 配列内の値を全て足す + +charST = rpg(job, sex, stamp, bingo, sumexp) # ユーザーのキャラクタステータス + +## UPDATE EXP ## + +update_exp = 'UPDATE main SET exp=? WHERE id=?;' +db.execute(update_exp, charST[2], id) + +#### + +## GETTING EXP SUM ## + +sum_sql = 'SELECT SUM(exp) FROM main WHERE rank=0;' +sumexp = db.execute(sum_sql).flatten(2)[0] + +#### + +stamp = stamp_st.inject(:+) # 配列内の値を全て足す + +charST = rpg(job, sex, stamp, bingo, sumexp) # ユーザーのキャラクタステータス + +printf(" +<!-- キャラクターイメージの設定 --> +<div class=\"charIMG\"> +<img src=\"png/%s.png\"> +</div> +<div class=\"charSTATUS\"> +ID:%04d<br> +NAME:%s<br> +あなたのLv: %d / 全員のLv: %d<br> +当選確率: %3.3f \% +<div> +", charST[0], id-1, name, charST[2],sumexp , charST[1]) + +# End of bottom +print'</div>' +# End of outflam +print'</div>' +###### + +print' +</body> +</html> +' +##########
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/account.html Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,42 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>ゆるスタ登録ページ</title> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> + +<body> +<h1>ゆるスタ登録ページ</h1> +<p>入力してね</p> +<form method="POST" action="./accountcheck.rb"> +<p>名前:<input name="name" type="text">(ニックネーム)</p> +<p>生別:<select name="sex"> + <option value="B">男 + <option value="G">女 + </select></p> +<p>年代:<select name="age"> + <option>10代 + <option>20代 + <option>30代 + <option>40代 + <option>50代 + <option>60代以上 + </select></p> +<p>出身地:<select name="aria"> + <option>酒田市内 + <option>山形県内 + <option>県外 + </select></p> +<p>ジョブ:<select name="job"> + <option value="sensi">戦士 + <option value="madousi">魔法使い + <option value="yumi">弓使い + <option value="thief">盗賊 + </select></p> +<p>(好きな職業を選んでください)</p> +<input type="submit" value="OK"><br> +<img src="rain.png" width="" height="画像の高さ" alt="代替テキスト"> +</form> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/accountcheck.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,68 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +require 'sqlite3' +require 'cgi' +require './magic.rb' + +c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") +db = SQLite3::Database.new("sql/test.sq3") + +begin + result = db.execute("select * from main;") + max = "select max(id) from main;" +rescue + db.execute("create table main(id INTEGER PRIMARY KEY AUTOINCREMENT,name,sex,age,aria,job,stamp_status,stamp_img,exp INTEGER,rank INTEGER,magic)"); + db.execute("insert into main(name,sex,age,aria,job,stamp_status,stamp_img,exp,rank,magic) values('名前','性別','年代','住所','職業','スタンプ状況','スタンプ画像','レベル','当選順位','本人確認用')"); + result = db.execute("select * from main;") + max = "select max(id) from main;" +end + +id = c.cookies["id"][0] +c_magic = c.cookies["magic"][0] +name = c["name"] +job = c["job"] +age = c["age"] +sex = c["sex"] +aria = c["aria"] + +begin +sel = 'select * from main where id=? AND magic=?' +h = db.execute(sel, id.to_i, c_magic.to_i) +rescue +h == [] +end + +if id != nil && h != [] +update = 'update main set name=?, job=?, age=?, sex=?, aria=? where id=? and magic=?' +mg = c_magic +db.execute(update, name, job, age, sex, aria, id.to_i, mg.to_i) +else +code = magic() +id = db.execute(max).flatten(2)[0].to_i + 1 +mg = code[id] +sql = "insert into main(name,sex,age,aria,job,stamp_status,stamp_img,exp,rank,magic) values (?,?,?,?,?,?,?,?,?,?);" +db.execute(sql,name,sex,age,aria,job,'000010000','n,n,n,n,kamo,n,n,n,n',0,0,mg); #初期値 +end + +expires = "Mon, 28 Jul 2014 23:00:00 GMT" + +printf("Content-type: text/html; charset=UTF-8 +Set-Cookie:id=%s ;expires=%s +Set-Cookie:magic=%s;expires=%s\n\n",id,expires,mg.to_s,expires) + +print'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>Registering Account</title> +<link rel="stylesheet" type="text/css" href="design.css"> +</head>' +printf' +<p>登録が完了しました。</p> +<p>あなたのIDは%04dです。抽選はこのIDを元に行われます</p> +<p>下記リンクからスタンプラリーを開始して下さい!</p> +<p><a href="Bingo.rb"> >> Let\'s go to Stamp Rally << </a></p> +<p></p> + +</body></html> +',id.to_i-1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/.htaccess Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,9 @@ +AddHandler cgi-script .rb +AddType "text/html; charset=utf-8" .rb +AddType "text/html; charset=utf-8" .html +Options +ExecCGI +AuthUserFile /home/www/skip/minato2014/admin/.htpasswd +AuthGroupFile /dev/null +AuthName "ǧڥ" +AuthType Basic +require valid-user
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/.htpasswd Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,1 @@ +Murakami:7Y005Wtya7Ogw
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/drawLots.html Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,24 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>Database delete</title> +</style> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> + +<body> +<h1>抽選用ページ</h1> +<p>実行するとデータベースが書き変えられます。</p> +<p>実行する際は注意してください。</p> +<form method="POST" action="./chusen.rb"> +<p>抽選を行いますか?<br> +はい<input type="radio" name="check" value="OK"> +いいえ<input type="radio" name="check" value="NO"> +</p> +<input type="submit" value="抽選"> +<input type="reset" value="リセット"> +</form> + +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/drawLots.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,85 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +require 'sqlite3' +require 'cgi' +require 'date' + +c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") +db = SQLite3::Database.new("../sql/stamp.sq3") + +add = ENV["REMOTE_ADDR"] + +if /^(172\.19\.5\.|172\.17\.54\.|172\.21\.90\.)|118.21.142.107|202.214.125.107/ =~ add +check = c['check'] + +printf("Content-type: text/html; charset=UTF-8\n\n") + +sum = 'SELECT SUM(rank) FROM main WHERE NOT id=1;' +rank_sum = db.execute(sum).flatten(2)[0].to_i + +t = Time.now +expires = Time.local(2014, 7, 26, 11, 27) +expires2 = Time.local(2014, 7, 26, 13, 27) +if t > expires && rank_sum == 0 +elsif t > expires2 && rank_sum == 7 +else + check = "" + puts check +end + +if check == "OK" + begin + result = db.execute("select id,exp,rank from main;") + rescue + exit + end + all = Array.new + for id,lv,rank in result + if id == 1 || lv == 0 || rank.to_i != 0 + next + end + lv.to_i.times do + all << id + end + end + + tousen = Array.new(0) + atari1 = rand(all.length) + tousen << all[atari1] + all.delete_if {|x| x == tousen[0]} + + sql = "update main set rank = 1 where id = ?;" + db.execute(sql,tousen[0]) + + sql = "update main set rank = 2 where id = ?;" + while tousen.length < 4 + srand + atari2 = rand(all.length) + hoge = all[atari2] + tousen << all[atari2] + all.delete_if {|x| x == hoge} + db.execute(sql,hoge) + end + + i=0 + + printf("<p>1等はIDが%04dの方!おめでとー!</p>\n",tousen[i].to_i-1) + printf("<p>2等はIDが%04dと%04dと%04dの方!おめでとー!</p>\n",tousen[i+=1].to_i-1,tousen[i+=1].to_i-1,tousen[i+=1].to_i-1) +else + print"<p>抽選はまだ行いませんよ</p>\n" +end +else + printf("Content-type: text/html; charset=UTF-8\n\n") + + printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h +tml4/strict.dtd"> +<html> +<head> +<title>Delete table</title> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> +</body> +<p>管理者用ページのため閲覧できません。</p>' +end +print'</body></html>'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/monitor.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,82 @@ +#!/usr/bin/env ruby +#coding:utf-8 + +require'cgi' +require'sqlite3' + +db = SQLite3::Database.new("../sql/stamp.sq3") + +c = CGI.new(:accept_charaset => "UTF-8") + +add = ENV["REMOTE_ADDR"] + +if /^(172\.19\.5\.|172\.17\.54\.|172\.21\.90\.)|118.21.142.107|202.214.125.107/ =~ add +#rank = c["rank"] +flag = 0 +text = "<p>登録者一覧を表示します</p>\n" +begin +# if rank == "y" +# rank_reset = 'UPDATE main SET rank=0 WHERE NOT id=1;' +# db.execute(rank_reset) +# end + result = db.execute("select * from main;") + log = 'select * from logs;' + logs = db.execute(log) +rescue + flag = 1 + text = "<p>データがありません</p>\n" +end + +#rank = "n" + +printf("Content-type: text/html; charset=UTF-8\n\n") + +printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h +tml4/strict.dtd"> +<html> +<head> +<meta http-equiv="refresh" content="180;http://skip.koeki-prj.org/minato2014/admin/etsuran.rb"> +<title>Delete table</title> +</head> +</body> +<h1>データ閲覧ページ</h1>' +puts text +if flag == 1 +else + print"<table border = 1>\n" + result.each do |line| + printf("<tr><td>%04d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",line[0].to_i-1,line[1],line[2],line[3],line[4],line[8],line[9]) + end + print'</table>' +# print'<p><form method="POST" action="./etsuran.rb"> +#rankをリセットしますか?<br> +#NO <input name="rank" type="radio" value="n" checked="checked"> / +#YES <input name="rank" type="radio" value="y"><br> +#<input type="submit" value="submit"> +#</form></p> +#' +end + +print'<h1>ログの閲覧</h1>' +if flag == 1 +else + print'<marquee direction=up hspace=50 scrolldelay=1 loop=1 scrollamount=1000 behavior="slide" width=500 height=200><table style="margin=0;">' + logs.each do |line| + printf("<tr><td width=50px>%s</td><td width=50px>%04d</td><td width=100px>%s</td><td width=100px>%s</td></tr>\n",line[0],line[1].to_i-1,line[2],line[3]) + end + print"</table></marquee>" +end +else + printf("Content-type: text/html; charset=UTF-8\n\n") + + printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h +tml4/strict.dtd"> +<html> +<head> +<title>Delete table</title> +</head> +</body> +<p>管理者用ページのため閲覧できません。</p>' +end + +print'</body></html>'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/operation.html Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,26 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>Database delete</title> +</style> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> + +<body> +<h1>データベース消去用</h1> +<p>実行するとデータベースが削除されます。</p> +<p>実行する際は注意してください。</p> +<form method="POST" action="./delete.rb"> +<p>本当に消しますか?<br> +はい<input type="radio" name="check" value="OK"> +いいえ<input type="radio" name="check" value="NO"> +</p> +<input type="submit" value="削除"> +<input type="reset" value="リセット"> +</form> + +<address>c111126@g.koeki-u.ac.jp</address> + +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/admin/operation.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,51 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +require 'sqlite3' +require 'cgi' + +db = SQLite3::Database.new("../sql/stamp.sq3") +c = CGI.new(:accept_charaset => "UTF-8") + +add = ENV["REMOTE_ADDR"] + +printf("Content-type: text/html; charset=UTF-8\n\n") + +if /^(172\.19\.5\.|172\.17\.54\.|172\.21\.90\.)|118.21.142.107|202.214.125.107/ =~ add +check = c['check'] +if check == "OK" + begin + db.execute("drop table main;") + db.extcute("drop table logs;") + text = "<p>データを削除しました。</p>" + rescue + text = "<p>データがありません。</p>" + end +else + text = "データは削除されません" +end + +printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>Delete table</title> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> +</body> +%s +<p><a href="etsuran.rb">データ閲覧ページへ</a></p> +<p></p> +</body></html> +',text + +else + printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h +tml4/strict.dtd"> +<html> +<head> +<title>Delete table</title> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> +</body> +<p>管理者用ページのため閲覧できません。</p>' +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/magic.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +def magic() + srand(123456789) + hoge = Array.new + while hoge.length < 100 + hoge << rand(1000000) + hoge.uniq! + end + return hoge +end +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/sql/.htaccess Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,1 @@ +deny from all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2014OC/sub.rb Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,21 @@ +#!/usr/koeki/bin/ruby +# -*- coding:utf-8 -*- + +def rpg(job,sex,stump,bingo,sumexp) + lv = [1,4,10,16,24,33,49] + exp = stump + (bingo * 5) + iro = 0 + for hoge in lv + if exp >= hoge + iro += 1 + end + end + per = (exp.to_f)*100 / (sumexp.to_f) + png = job + "" + sex + "" + iro.to_s + ret = [png,per,exp] + return ret +end +#job = "sensi" +#sex = "G" +#hoge = rpg(job,sex,5,2,100) #職業,性別,スタンプ数,ビンゴ数,総経験値 +#puts hoge
--- a/minato2014/account.html Sat Jul 26 11:24:46 2014 +0900 +++ b/minato2014/account.html Thu Jul 31 16:09:51 2014 +0900 @@ -7,36 +7,11 @@ </head> <body> -<h1>ゆるスタ登録ページ</h1> -<p>入力してね</p> -<form method="POST" action="./accountcheck.rb"> -<p>名前:<input name="name" type="text">(ニックネーム)</p> -<p>生別:<select name="sex"> - <option value="B">男 - <option value="G">女 - </select></p> -<p>年代:<select name="age"> - <option>10代 - <option>20代 - <option>30代 - <option>40代 - <option>50代 - <option>60代以上 - </select></p> -<p>出身地:<select name="aria"> - <option>酒田市内 - <option>山形県内 - <option>県外 - </select></p> -<p>ジョブ:<select name="job"> - <option value="sensi">戦士 - <option value="madousi">魔法使い - <option value="yumi">弓使い - <option value="thief">盗賊 - </select></p> -<p>(好きな職業を選んでください)</p> -<input type="submit" value="OK"><br> -<img src="rain.png" width="" height="画像の高さ" alt="代替テキスト"> -</form> + +<p> +<h1>ゆるきゃらスタンプラリー2014は7月26日(土)を持ちまして終了致しました。 +ご参加ありがとう御座いました!</h1> +</p> + </body> </html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/minato2014/account2.html Thu Jul 31 16:09:51 2014 +0900 @@ -0,0 +1,42 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<title>ゆるスタ登録ページ</title> +<link rel="stylesheet" type="text/css" href="design.css"> +</head> + +<body> +<h1>ゆるスタ登録ページ</h1> +<p>入力してね</p> +<form method="POST" action="./accountcheck.rb"> +<p>名前:<input name="name" type="text">(ニックネーム)</p> +<p>生別:<select name="sex"> + <option value="B">男 + <option value="G">女 + </select></p> +<p>年代:<select name="age"> + <option>10代 + <option>20代 + <option>30代 + <option>40代 + <option>50代 + <option>60代以上 + </select></p> +<p>出身地:<select name="aria"> + <option>酒田市内 + <option>山形県内 + <option>県外 + </select></p> +<p>ジョブ:<select name="job"> + <option value="sensi">戦士 + <option value="madousi">魔法使い + <option value="yumi">弓使い + <option value="thief">盗賊 + </select></p> +<p>(好きな職業を選んでください)</p> +<input type="submit" value="OK"><br> +<img src="rain.png" width="" height="画像の高さ" alt="代替テキスト"> +</form> +</body> +</html>