Mercurial > hgrepos > hgweb.cgi > skipweb
view coop/entry.rb @ 2169:c2c3932b63af
環境変数の表示
author | SUZUKI Takehisa <c110128@e.koeki-u.ac.jp> |
---|---|
date | Wed, 18 Dec 2013 20:17:00 +0900 |
parents | d29fe5c60dbb |
children | baaeb73afad3 |
line wrap: on
line source
#!/usr/bin/env ruby # coding: euc-jp require 'cgi' c = CGI.new(:accept_charset => "EUC-JP") i = 0 ip = ENV['REMOTE_ADDR'] print "Content-type: text/html; charset=EUC-JP\n\n" print "<html> <head><title>サンプル</title><link rel=\"stylesheet\" type = \"text/css\" href=\"data.css\"></head><body>" print"<table>" ENV.each { |k,v| print "<tr><td>#{k}</td><td>#{v}</td></tr>\n" } print"</table>" srand(56384679263254687) 10000.times {rand(1000000)} idlist = (1..100).collect{rand(10000000)} if idlist.index(ARGV[0].to_i) print"<p>おめでとう</p>" print"<p>#{ip}</p>" elsif print"<p>残念</p>" end print"</body></html>\n"