Mercurial > hgrepos > hgweb.cgi > skipweb
comparison event/oasis2017/idol/blue_1.rb @ 3362:3807cbca3fcd
img
author | KASHIWAGURA Aya <c115046@?.koeki-u.ac.jp> |
---|---|
date | Tue, 25 Jul 2017 13:07:15 +0900 |
parents | |
children | 24603571d75c |
comparison
equal
deleted
inserted
replaced
3361:d7bf49c69d03 | 3362:3807cbca3fcd |
---|---|
1 #!/usr/bin/env ruby | |
2 # coding: utf-8 | |
3 | |
4 # tail -f /usr/local/apache2/logs/error_log | |
5 | |
6 require 'cgi' | |
7 c = CGI.new(:accept_charset => 'utf-8') | |
8 | |
9 page = Hash.new | |
10 n = 0 | |
11 img = "" | |
12 | |
13 | |
14 open("red1a.txt","r:utf-8") do |cat| | |
15 | |
16 while line = cat.gets | |
17 if /(\d+)\s+(\S+)\s+/ =~line | |
18 page[$1] = $2 | |
19 end | |
20 end | |
21 end | |
22 | |
23 | |
24 p = c["page"] | |
25 if p=="" | |
26 p="1"# page変数指定がなければ "1" とする | |
27 end | |
28 | |
29 ib = c["cv"] | |
30 gin = c["adm"] | |
31 name = c["name"] | |
32 | |
33 puts "Content-type: text/html; charset=utf-8 | |
34 | |
35 <html> | |
36 <head><title>アイエキ、しよ?</title> | |
37 <link rel=\"stylesheet\" type=\"text/css\" href=\"ema3.css\" > | |
38 <meta name=\"viewport\" content=\"width=device-width\"> | |
39 | |
40 </head> | |
41 <body> | |
42 | |
43 <form method=\"POST\" action=\"red_1.rb\">" | |
44 | |
45 # ページ番号による切り替え処理 | |
46 printf("<p>%s</p>\n", page[p]) # ページ番号に応じたメッセージ出力 | |
47 | |
48 | |
49 | |
50 case p | |
51 when "1" | |
52 nextpage = "2" | |
53 | |
54 when "2" | |
55 nextpage = "3" | |
56 | |
57 when "3" | |
58 nextpage = "4" | |
59 | |
60 when "4" | |
61 nextpage = "5" | |
62 | |
63 when "5" | |
64 nextpage = "6" | |
65 | |
66 when "6" | |
67 print(<<-"EOF") | |
68 <a href="">NEXT STAGE・・・</a> | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 EOF | |
75 nextpage = nil | |
76 | |
77 end | |
78 | |
79 | |
80 if nextpage | |
81 | |
82 printf("<input type=\"hidden\" name=\"page\" value=\"%s\">\n", nextpage) | |
83 printf("<img src=\"%s\">\n",img) | |
84 puts('<br><INPUT type="button" onclick="history.back()" value="前へ">') | |
85 puts('<input type="submit" value="次へ">') | |
86 | |
87 end | |
88 | |
89 puts "</form> | |
90 </body> | |
91 </html>" |