Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2298:4345cb73fbcc
minato2014/admin added
author | FUJIKAWA Kosuke <c111126@g.koeki-u.ac.jp> |
---|---|
date | Wed, 23 Jul 2014 20:30:30 +0900 |
parents | 190e04b6a2d2 |
children | 9912bdfdae14 |
files | minato2014/admin/.htaccess minato2014/admin/.htpasswd minato2014/admin/chusen.rb minato2014/admin/delete.html minato2014/admin/delete.rb minato2014/admin/etsuran.rb minato2014/delete.html minato2014/delete.rb |
diffstat | 8 files changed, 163 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 20:30:30 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/irhome/c111/c111126/public_html/mycgi/minato/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 20:30:30 2014 +0900 @@ -0,0 +1,2 @@ +fujix:fu5QjLTqbHEaQ +shokok:9tQUls7fXzqMA
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/minato2014/admin/chusen.rb Wed Jul 23 20:30:30 2014 +0900 @@ -0,0 +1,49 @@ +#!/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") + +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) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/minato2014/admin/delete.html Wed Jul 23 20:30:30 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 20:30:30 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 20:30:30 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 19:50:22 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 19:50:22 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