diff --git a/event/oasis2017/idol/db/.htaccess b/event/oasis2017/idol/db/.htaccess new file mode 100644 index 0000000..9516bed --- /dev/null +++ b/event/oasis2017/idol/db/.htaccess @@ -0,0 +1,7 @@ + + Order deny,allow + Deny from all + +AddHandler cgi-script .rb +AddType "text/html; charset=utf-8" .rb +Options +ExecCGI diff --git a/event/oasis2017/idol/home.rb b/event/oasis2017/idol/home.rb index 0450855..caf2c0c 100755 --- a/event/oasis2017/idol/home.rb +++ b/event/oasis2017/idol/home.rb @@ -4,7 +4,7 @@ # tail -f /usr/local/apache2/logs/error_log require 'sqlite3' -file = "db/uesrs.sq3" +file = "../db/users.sq3" require 'cgi' c = CGI.new(:accept_charset => 'utf-8') @@ -75,7 +75,7 @@ gin = "red" end - puts "Content-type: text/html; charset=utf-8" + r = db.execute("SELECT count(*) FROM point WHERE id=?", id)[0] pt = (r ? r[0] : 0) @@ -136,19 +136,20 @@ point = nil -if ARGV[0] == "508568506962120147" #1つ目 - point = "idol-1" -elsif ARGV[0] =="381770736200286426" #二つ目 - point = "idol-2" -elsif ARGV[0] =="942515613567750545" #三つ目 - point = "idol-3" -elsif ARGV[0] =="849054474888775292" #四つ目 - point = "idol-4" -elsif ARGV[0] =="61520500659400819" #五つ目 - point = "idol-5" -elsif ARGV[0] =="528856582528717535" #六つ目 - point = "idol-6" +if ARGV[0] == "A" #1つ目 + point = "50" +elsif ARGV[0] =="B" #二つ目 + point = "100" +elsif ARGV[0] =="C" #三つ目 + point = "60" +elsif ARGV[0] =="D" #四つ目 + point = "80" +elsif ARGV[0] =="E" #五つ目 + point = "120" +elsif ARGV[0] =="F" #六つ目 + point = "150" end + if point db.execute("REPLACE INTO point VALUES(?, ?)", id, point) end @@ -164,6 +165,9 @@ elsif pt < 560 printf("
現在の獲得ポイント数:%s
",pt) end + + + case gin when "red" if pt >= 100 && pt < 200 diff --git a/event/oasis2017/idol/pro.rb b/event/oasis2017/idol/pro.rb index 3dd8151..5c9866e 100755 --- a/event/oasis2017/idol/pro.rb +++ b/event/oasis2017/idol/pro.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'sqlite3' -file = "db/point.sq3" +file = "../db/users.sq3" require 'cgi' c = CGI.new(:accept_charset => "UTF-8") @@ -30,7 +30,7 @@ printf("Content-type: text/html; charset=UTF-8\n") printf("Set-Cookie: id=%s; expires=%s\n\n", id, expire) -db = SQLite3::Database.new("db/users.sq3") +db = SQLite3::Database.new("file") db.execute("PRAGMA foreign_keys=on") db.execute("CREATE TABLE IF NOT EXISTS " + "users(id text primary key, name text, creation text)") diff --git a/event/oasis2017/idol/tess.rb b/event/oasis2017/idol/tess.rb index f053e13..e2ab955 100755 --- a/event/oasis2017/idol/tess.rb +++ b/event/oasis2017/idol/tess.rb @@ -30,7 +30,7 @@ printf("Content-type: text/html; charset=UTF-8\n") printf("Set-Cookie: id=%s; expires=%s\n\n", id, expire) -db = SQLite3::Database.new("db/users.sq3") +db = SQLite3::Database.new("../db/users.sq3") db.execute("PRAGMA foreign_keys=on") db.execute("CREATE TABLE IF NOT EXISTS " + "users(id text primary key, name text, creation text)")