changeset 2301:8e2be535b244

merged
author MURAKAMI Masaki <c112124@h.koeki-u.ac.jp>
date Wed, 23 Jul 2014 21:25:09 +0900
parents 6e6a7014a8bf (current diff) 1e7786ae4a87 (diff)
children 350a801e8e74
files minato2014/delete.html minato2014/delete.rb
diffstat 9 files changed, 192 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/.htaccess	Wed Jul 23 21:25:09 2014 +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/minato2014/admin/.htpasswd
+AuthGroupFile /dev/null
+AuthName "วงพฺฅตฅคฅศ"
+AuthType Basic
+require valid-user
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/.htpasswd	Wed Jul 23 21:25:09 2014 +0900
@@ -0,0 +1,2 @@
+fujix:fu5QjLTqbHEaQ
+shokok:9tQUls7fXzqMA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/chusen.html	Wed Jul 23 21:25:09 2014 +0900
@@ -0,0 +1,26 @@
+<!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="./chusen.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>
+
+<address>c111126@g.koeki-u.ac.jp</address>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/chusen.rb	Wed Jul 23 21:25:09 2014 +0900
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+require 'sqlite3'
+require 'cgi'
+
+c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8")
+db = SQLite3::Database.new("../sql/stamp.sq3")
+
+check = c['check']
+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 == "ID" || 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("Content-type: text/html; charset=UTF-8\n\n")
+  
+  printf("<p>1็ญ‰ใฏIDใŒ%04dใฎๆ–น!ใŠใ‚ใงใจใƒผ!</p>\n",tousen[i].to_i)
+  printf("<p>2็ญ‰ใฏIDใŒ%04dใจ%04dใจ%04dใฎๆ–น!ใŠใ‚ใงใจใƒผ!</p>\n",tousen[i+=1].to_i,tousen[i+=1].to_i,tousen[i+=1].to_i)
+else
+  print"<p>ๆŠฝ้ธใฏใพใ ่กŒใ„ใพใ›ใ‚“ใ‚ˆ</p>"
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/delete.html	Wed Jul 23 21:25:09 2014 +0900
@@ -0,0 +1,26 @@
+<!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="./delete.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>
+
+<address>c111126@g.koeki-u.ac.jp</address>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/delete.rb	Wed Jul 23 21:25:09 2014 +0900
@@ -0,0 +1,36 @@
+#!/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")
+check = c['check']
+if check == "OK"
+  begin
+    db.execute("drop table main;")
+    db.extcute("drop table logs;")
+    text = "<p>ใƒ‡ใƒผใ‚ฟใ‚’ๅ‰Š้™คใ—ใพใ—ใŸใ€‚</p>"
+  rescue
+    text = "<p>ใƒ‡ใƒผใ‚ฟใŒใ‚ใ‚Šใพใ›ใ‚“ใ€‚</p>"
+  end
+else
+  text = "ใƒ‡ใƒผใ‚ฟใฏๅ‰Š้™คใ•ใ‚Œใพใ›ใ‚“"
+end
+
+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/html4/strict.dtd">
+<html>
+<head>
+<title>Delete table</title>
+<link rel="stylesheet" type="text/css" href="design.css">
+</head>
+</body>
+%s
+<p><a href="etsuran.rb">ใƒ‡ใƒผใ‚ฟ้–ฒ่ฆงใƒšใƒผใ‚ธใธ</a></p>
+<p></p>
+</body></html>
+',text
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minato2014/admin/etsuran.rb	Wed Jul 23 21:25:09 2014 +0900
@@ -0,0 +1,41 @@
+#!/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")
+
+flag = 0
+text = "<p>็™ป้Œฒ่€…ไธ€่ฆงใ‚’่กจ็คบใ—ใพใ™</p>\n"
+begin
+  result = db.execute("select * from main;")
+rescue
+  flag = 1
+  text = "<p>ใƒ‡ใƒผใ‚ฟใŒใ‚ใ‚Šใพใ›ใ‚“</p>\n"
+end
+
+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>
+<h1>ใƒ‡ใƒผใ‚ฟ้–ฒ่ฆงใƒšใƒผใ‚ธ</h1>'
+puts text
+if flag == 1
+else
+  print"<table border = 1>\n"
+  result.each do |line|
+    printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",line[0],line[1],line[2],line[3],line[4],line[8],line[9])
+  end
+ print"</table>"
+end
+
+print'</body></html>'
--- a/minato2014/delete.html	Wed Jul 23 21:24:41 2014 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<!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="./delete.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>
-
-<address>c111126@g.koeki-u.ac.jp</address>
-
-</body>
-</html>
--- a/minato2014/delete.rb	Wed Jul 23 21:24:41 2014 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#!/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")
-check = c['check']
-if check == "OK"
-  begin
-    db.execute("drop table main;")
-    db.extcute("drop table logs;")
-    text = "<p>ใƒ‡ใƒผใ‚ฟใ‚’ๅ‰Š้™คใ—ใพใ—ใŸใ€‚</p>"
-  rescue
-    text = "<p>ใƒ‡ใƒผใ‚ฟใŒใ‚ใ‚Šใพใ›ใ‚“ใ€‚</p>"
-  end
-else
-  text = "ใƒ‡ใƒผใ‚ฟใฏๅ‰Š้™คใ•ใ‚Œใพใ›ใ‚“"
-end
-
-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/html4/strict.dtd">
-<html>
-<head>
-<title>Delete table</title>
-<link rel="stylesheet" type="text/css" href="design.css">
-</head>
-</body>
-%s
-<p><a href="etsuran.rb">ใƒ‡ใƒผใ‚ฟ้–ฒ่ฆงใƒšใƒผใ‚ธใธ</a></p>
-<p></p>
-</body></html>
-',text

yatex.org