view etsuran.rb @ 3386:015c93071704

rogin.rvÊѹ¹£³
author OOTANI Hiroyuki <c115036@g.koeki-u.ac.jp>
date Wed, 26 Jul 2017 23:25:26 +0900
parents bd675bc7adcf
children
line wrap: on
line source

#!/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>'

yatex.org