Mercurial > hgrepos > hgweb.cgi > skipweb
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