Mercurial > hgrepos > hgweb.cgi > skipweb
view 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 |
line wrap: on
line source
#!/usr/bin/env ruby # coding: utf-8 # tail -f /usr/local/apache2/logs/error_log require 'cgi' c = CGI.new(:accept_charset => 'utf-8') page = Hash.new n = 0 img = "" open("red1a.txt","r:utf-8") do |cat| while line = cat.gets if /(\d+)\s+(\S+)\s+/ =~line page[$1] = $2 end end end p = c["page"] if p=="" p="1"# page変数指定がなければ "1" とする end ib = c["cv"] gin = c["adm"] name = c["name"] puts "Content-type: text/html; charset=utf-8 <html> <head><title>アイエキ、しよ?</title> <link rel=\"stylesheet\" type=\"text/css\" href=\"ema3.css\" > <meta name=\"viewport\" content=\"width=device-width\"> </head> <body> <form method=\"POST\" action=\"red_1.rb\">" # ページ番号による切り替え処理 printf("<p>%s</p>\n", page[p]) # ページ番号に応じたメッセージ出力 case p when "1" nextpage = "2" when "2" nextpage = "3" when "3" nextpage = "4" when "4" nextpage = "5" when "5" nextpage = "6" when "6" print(<<-"EOF") <a href="">NEXT STAGE・・・</a> EOF nextpage = nil end if nextpage printf("<input type=\"hidden\" name=\"page\" value=\"%s\">\n", nextpage) printf("<img src=\"%s\">\n",img) puts('<br><INPUT type="button" onclick="history.back()" value="前へ">') puts('<input type="submit" value="次へ">') end puts "</form> </body> </html>"