Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2166:48381ff72d4a
DB関連削除
author | SUZUKI Takehisa <c110128@e.koeki-u.ac.jp> |
---|---|
date | Wed, 18 Dec 2013 19:43:13 +0900 |
parents | e3924f5a7a36 |
children | 7611cb9532c1 |
files | coop/entry.rb |
diffstat | 1 files changed, 8 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/coop/entry.rb Wed Dec 18 19:40:16 2013 +0900 +++ b/coop/entry.rb Wed Dec 18 19:43:13 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'] @@ -23,37 +13,15 @@ <head><title>サンプル</title><link rel=\"stylesheet\" type = \"text/css\" href=\"data.css\"></head><body>" -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 - } +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 -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>" - -end print"</body></html>\n"