changeset 801:b5fc06768130

.htaccess 2014
author ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp>
date Wed, 15 Jul 2015 21:32:00 +0900
parents 9a3f2bd8c9e0
children 3290ba8f879e
files oasis2015/admin/.htaccess oasis2015/admin/.htpasswd oasis2015/admin2/.htaccess oasis2015/admin2/.htpasswd oasis2015/admin2/drawLots.html oasis2015/admin2/drawLots.rb oasis2015/admin2/monitor.rb oasis2015/admin2/operation.html oasis2015/admin2/operation.rb
diffstat 9 files changed, 294 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/oasis2015/admin/.htaccess	Wed Jul 15 21:30:14 2015 +0900
+++ b/oasis2015/admin/.htaccess	Wed Jul 15 21:32:00 2015 +0900
@@ -2,7 +2,7 @@
 AddType "text/html; charset=utf-8" .rb
 AddType "text/html; charset=utf-8" .html
 Options +ExecCGI
-AuthUserFile /home/www/skip/oasis2015/admin2/.htpasswd
+AuthUserFile /home/www/skip/2014OC/admin/.htpasswd
 AuthGroupFile /dev/null
 AuthName "HOGE"
 AuthType Basic
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin/.htpasswd	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,1 @@
+c113007:QRf28ARYqd/FY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/.htaccess	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,9 @@
+AddHandler cgi-script   .rb
+AddType	"text/html; charset=utf-8" .rb
+AddType	"text/html; charset=utf-8" .html
+Options +ExecCGI
+AuthUserFile /home/www/skip/2014OC/admin/.htpasswd
+AuthGroupFile /dev/null
+AuthName "ǧ¾Ú¥µ¥¤¥È"
+AuthType Basic
+require valid-user
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/.htpasswd	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,2 @@
+Murakami:7Y005Wtya7Ogw
+test:tebUY14UFwMKg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/drawLots.html	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Database delete</title>
+</style>
+<link rel="stylesheet" type="text/css" href="design.css">
+</head>
+
+<body>
+<h1>抽é¸ç”¨ãƒšãƒ¼ã‚¸</h1>
+<p>実行ã™ã‚‹ã¨ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãŒæ›¸ã変ãˆã‚‰ã‚Œã¾ã™ã€‚</p>
+<p>実行ã™ã‚‹éš›ã¯æ³¨æ„ã—ã¦ãã ã•ã„。</p>
+<form method="POST" action="./drawLots.rb">
+<p>抽é¸ã‚’è¡Œã„ã¾ã™ã‹?<br>
+ã¯ã„<input type="radio" name="check" value="OK"> 
+ã„ã„ãˆ<input type="radio" name="check" value="NO">
+</p>
+<input type="submit" value="抽é¸">
+<input type="reset" value="リセット">
+</form>
+<p><a href="monitor.rb">データ閲覧ページã«æˆ»ã‚‹</a></p>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/drawLots.rb	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,87 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+require 'sqlite3'
+require 'cgi'
+require 'date'
+
+c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8")
+db = SQLite3::Database.new("../sql/stamp.sq3")
+
+add = ENV["REMOTE_ADDR"]
+
+if /^(172\.19\.5\.|172\.17\.54\.|172\.21\.90\.)|118.21.142.107|202.214.125.107|192.168.43.255/ =~ add
+check = c['check']
+
+printf("Content-type: text/html; charset=UTF-8\n\n")
+
+sum = 'SELECT SUM(rank) FROM main WHERE NOT id=1;'
+rank_sum = db.execute(sum).flatten(2)[0].to_i
+
+t = Time.now
+expires = Time.local(2014, 8, 17, 8, 50)
+expires2 = Time.local(2014, 10, 25, 0, 00)
+if t > expires && t < expires2 && rank_sum == 0
+else
+  check = ""
+  puts check
+end
+
+if check == "OK"
+  begin
+    result = db.execute("select id,exp,rank from main;")
+  rescue
+    exit
+  end
+  all = Array.new
+  for id,lv,rank in result
+    if id == 1 || lv == 0 || rank.to_i != 0
+      next
+    end
+    lv.to_i.times do
+      all << id
+    end
+  end
+  
+  tousen = Array.new(0)
+  atari1 = rand(all.length)
+  tousen << all[atari1]
+  all.delete_if {|x| x == tousen[0]}
+  
+  sql = "update main set rank = 1 where id = ?;"
+  db.execute(sql,tousen[0])
+  
+  sql = "update main set rank = 2 where id = ?;"
+  while tousen.length < 4
+    srand
+    atari2 = rand(all.length)
+    hoge = all[atari2]
+    tousen << all[atari2]
+    all.delete_if {|x| x == hoge}
+    db.execute(sql,hoge)
+  end
+  
+  i=0
+  
+  printf("<p>1ç­‰ã¯IDãŒ%04dã®æ–¹!ãŠã‚ã§ã¨ãƒ¼!</p>\n",tousen[i].to_i-1)
+  printf("<p>2ç­‰ã¯IDãŒ%04dã¨%04dã¨%04dã®æ–¹!ãŠã‚ã§ã¨ãƒ¼!</p>\n",tousen[i+=1].to_i-1,tousen[i+=1].to_i-1,tousen[i+=1].to_i-1)
+else
+  print"<p>抽é¸ã¯ã¾ã è¡Œã„ã¾ã›ã‚“よ</p>\n"
+end
+print'<p><a href="drawLots.html">抽é¸ãƒšãƒ¼ã‚¸ã«æˆ»ã‚‹</a></p>
+<p><a href="monitor.rb">データ閲覧ページã«æˆ»ã‚‹</a></p>
+'
+else
+  printf("Content-type: text/html; charset=UTF-8\n\n")
+  
+  printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h
+tml4/strict.dtd">
+<html>
+<head>
+<title>Delete table</title>
+<link rel="stylesheet" type="text/css" href="design.css">
+</head>
+</body>
+<p>管ç†è€…用ページã®ãŸã‚閲覧ã§ãã¾ã›ã‚“。</p>'
+end
+print'</body></html>'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/monitor.rb	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,91 @@
+#!/usr/bin/env ruby
+#coding:utf-8
+
+require'cgi'
+require'sqlite3'
+
+db = SQLite3::Database.new("../sql/stamp.sq3")
+
+c = CGI.new(:accept_charaset => "UTF-8")
+
+add = ENV["REMOTE_ADDR"]
+
+if /^(172\.19\.5\.|172\.17\.54\.|172\.21\.90\.)|118.21.142.107|202.214.125.107/ =~ add
+rank = c["rank"]
+flag = 0
+text = "<p>登録者一覧を表示ã—ã¾ã™</p>\n"
+begin
+  if rank == "y"
+    rank_reset = 'UPDATE main SET rank=0 WHERE NOT id=1;'
+    db.execute(rank_reset)
+  end
+  result = db.execute("select * from main;")
+  log = 'select * from logs;'
+  logs = db.execute(log)
+rescue
+  flag = 1
+  text = "<p>データãŒã‚ã‚Šã¾ã›ã‚“</p>\n"
+end
+
+#rank = "n"
+
+printf("Content-type: text/html; charset=UTF-8\n\n")
+
+printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h
+tml4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="refresh" content="180;http://skip.koeki-prj.org/2014OC/admin/monitor.rb">
+<title>Delete table</title>
+</head>
+</body>
+<h1>データ閲覧ページ</h1>'
+puts text
+if flag == 1
+else
+  print"<table border = 1>\n"
+  result.each do |line|
+    printf("<tr><td>%04d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",line[0].to_i-1,line[1],line[2],line[3],line[4],line[8],line[9])
+  end
+  print'</table>'
+  print'<p><form method="POST" action="./monitor.rb">
+rankをリセットã—ã¾ã™ã‹?<br>
+NO <input name="rank" type="radio" value="n" checked="checked"> / 
+YES <input name="rank" type="radio" value="y"><br>
+<input type="submit" value="submit">
+</form></p>
+'
+end
+
+print'<h1>ログã®é–²è¦§</h1>'
+if flag == 1
+else
+  print'<marquee direction=up hspace=50 scrolldelay=1 loop=1 scrollamount=1000 behavior="slide" width=500 height=200><table style="margin=0;">'
+  logs.each do |line|
+    hour = line[3].to_i/3600
+    min = line[3].to_i%3600/60
+    sec = line[3].to_i%3600%60
+    printf("<tr><td width=50px>%s</td><td width=50px>%04d</td><td width=100px>%s</td><td width=100px>%d:%d:%d</td></tr>\n",line[0],line[1].to_i-1,line[2],hour,min,sec)
+  end
+  print"</table></marquee>"
+  print'<h1>ãã®ä»–ã®æ“作</h1>
+<table border="1">
+<tr><th>データ削除</th><td><a href="operation.html">DELETE</a></td></tr>
+<tr><th>抽é¸</th><td><a href="drawLots.html">DRAW</a></td></tr>
+</table>
+'
+end
+else
+  printf("Content-type: text/html; charset=UTF-8\n\n")
+  
+  printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h
+tml4/strict.dtd">
+<html>
+<head>
+<title>Delete table</title>
+</head>
+</body>
+<p>管ç†è€…用ページã®ãŸã‚閲覧ã§ãã¾ã›ã‚“。</p>'
+end
+
+print'</body></html>'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/operation.html	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Database delete</title>
+</style>
+<link rel="stylesheet" type="text/css" href="design.css">
+</head>
+
+<body>
+<h1>データベース消去用</h1>
+<p>実行ã™ã‚‹ã¨ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãŒå‰Šé™¤ã•ã‚Œã¾ã™ã€‚</p>
+<p>実行ã™ã‚‹éš›ã¯æ³¨æ„ã—ã¦ãã ã•ã„。</p>
+<form method="POST" action="./operation.rb">
+<p>本当ã«æ¶ˆã—ã¾ã™ã‹?<br>
+ã¯ã„<input type="radio" name="check" value="OK"> 
+ã„ã„ãˆ<input type="radio" name="check" value="NO">
+</p>
+<input type="submit" value="削除">
+<input type="reset" value="リセット">
+</form>
+<p><a href="monitor.rb">データ閲覧ページã«æˆ»ã‚‹</a></p>
+
+<address>c111126@g.koeki-u.ac.jp</address>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oasis2015/admin2/operation.rb	Wed Jul 15 21:32:00 2015 +0900
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+require 'sqlite3'
+require 'cgi'
+
+db = SQLite3::Database.new("../sql/stamp.sq3")
+c = CGI.new(:accept_charaset => "UTF-8")
+
+add = ENV["REMOTE_ADDR"]
+
+printf("Content-type: text/html; charset=UTF-8\n\n")
+
+if /^(172\.19\.5\.|172\.17\.54\.|172\.21\.90\.)|118.21.142.107|202.214.125.107/ =~ add
+check = c['check']
+if check == "OK"
+  begin
+    db.execute("drop table main;")
+    db.execute("drop table logs;")
+    text = "<p>データを削除ã—ã¾ã—ãŸã€‚</p>"
+  rescue
+    text = "<p>データãŒã‚ã‚Šã¾ã›ã‚“。</p>"
+  end
+else
+  text = "データã¯å‰Šé™¤ã•ã‚Œã¾ã›ã‚“"
+end
+
+printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
+<html>
+<head>
+<title>Delete table</title>
+<link rel=\"stylesheet\" type=\"text/css\" href=\"design.css\">
+</head>
+</body>
+%s
+<p><a href=\"monitor.rb\">データ閲覧ページã¸</a></p>
+<p></p>
+</body></html>
+", text)
+print"<p><a href=\"monitor.rb\">データ閲覧ページã«æˆ»ã‚‹</a></p>"
+print"<p><a href=\"opration.html\">削除ページã«æˆ»ã‚‹</a></p>"
+else  
+  printf'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h
+tml4/strict.dtd">
+<html>
+<head>
+<title>Delete table</title>
+<link rel="stylesheet" type="text/css" href="design.css">
+</head>
+</body>
+<p>管ç†è€…用ページã®ãŸã‚閲覧ã§ãã¾ã›ã‚“。</p>'
+end

yatex.org