comparison event/oasis2017/idol/red_1.rb @ 1627:350233cfbb56

img
author KASHIWAGURA Aya<c115046@?.koeki-u.ac.jp>
date Tue, 25 Jul 2017 13:07:15 +0900
parents
children 7adcc182c1c6
comparison
equal deleted inserted replaced
1626:435ce8a175c0 1627:350233cfbb56
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 <b><a href="home.rb">NEXT STAGE・・・</a></b>
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>"

yatex.org