Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2169:c2c3932b63af
環境変数の表示
author | SUZUKI Takehisa <c110128@e.koeki-u.ac.jp> |
---|---|
date | Wed, 18 Dec 2013 20:17:00 +0900 |
parents | d29fe5c60dbb |
children | 8861a772ef67 |
files | coop/entry.rb |
diffstat | 1 files changed, 8 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/coop/entry.rb Wed Dec 18 20:14:36 2013 +0900 +++ b/coop/entry.rb Wed Dec 18 20:17:00 2013 +0900 @@ -1,20 +1,10 @@ #!/usr/bin/env ruby # coding: euc-jp -require 'pg' require 'cgi' -require 'date' c = CGI.new(:accept_charset => "EUC-JP") -pghost = "localhost" -pgport = 5432 -pgoptions = nil -pgtty = nil -dbname = "coop" -dbuser = "c110128" -passwd = nil - i = 0 ip = ENV['REMOTE_ADDR'] @@ -31,36 +21,15 @@ print"</table>" -begin - conn = PGconn.connect(pghost,pgport,pgoptions,pgtty,dbname,dbuser,passwd) - tuple = conn.exec( - "select count(*) from log;" - ) -rescue - print"<p>error</p>" -else - tuple.each{|line| - for comp in line - i = comp[1].to_i - end - } -end +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>" -if i < 100 - i = i + 1 - - 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>" - end -elsif i >= 100 - print"<p>ごめんなさい</p>" - print"<p>もう品切れです</p>" -else - print"<p>error</p>" +elsif + print"<p>残念</p>" end