Mercurial > hgrepos > hgweb.cgi > skipweb
view coop/entry.rb @ 2180:428be07823ba
entry.rb md5 => digest
author | SUZUKI Takehisa <c110128@e.koeki-u.ac.jp> |
---|---|
date | Fri, 24 Jan 2014 15:32:35 +0900 |
parents | 483100968342 |
children |
line wrap: on
line source
#!/usr/bin/env ruby # coding: euc-jp require 'cgi' #require 'digest' c = CGI.new('html4Tr') me = File.basename(c.script_name) c0 = c.cookies['id'] ip = ENV['REMOTE_ADDR'] i = 0 srand(56384679263254687) 10000.times {rand(1000000)} idlist = (1..100).collect{rand(10000000)} cookie = CGI::Cookie.new({'name' => 'id', 'value' => "#{ip}", 'domain' => c.server_name, 'path' => c.script_name}) cookie.expires = Time.now + 10 c.out({'cookie' => cookie}) do c.html({'PRETTY' => ' '}) do c.head do c.title {'サンプル'} end + c.body do if idlist.index(ARGV[0].to_i) c.p{'おめでとう'} + c.p{ c.code{cookie[0]}} elsif i >= 50 c.p{'ごめんなさい'} else c.p{'error'} end end end end