view minato2014/accountcheck.rb @ 545:785e500c8003

login page add
author FUJIKAWA Kosuke <c111126@g.koeki-u.ac.jp>
date Fri, 18 Jul 2014 15:44:16 +0900
parents f24e989eca53
children d6f37e2e9a2f
line wrap: on
line source

#!/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/stump.sq3")

begin
  result = db.execute("select * from main;")
rescue
  db.execute("create table main(id PRIMARY KEY,name,sex,age,aria,job,stamp_status,stamp_img,exp,rank,magic)");
  db.execute("insert into main values('ID','名前','性別','年代','住所','職業','スタンプ状況','スタンプ画像','レベル','当選順位','本人確認用')");
  result = db.execute("select * from main");
end

name = c["name"]
job  = c["job"]
age  = c["age"]
sex  = c["sex"]
aria = c["aria"]

id = result.length
printf("%04d",id)

mg = 0

sql = "insert into main values (?,?,?,?,?,?,?,?,?,?,?);"
db.execute(sql,id,name,aria,sex,age,job,'000010000','n,n,n,n,kamo,n,n,n,n','0','0',mg); #初期値

printf("Set-Cookie:id=%d; magic=%s\n",id,mg)
print"Content-type: text/html; charset=UTF-8 \n\n"

print'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Registering Account</title>
<link rel="stylesheet" type="text/css" href="design.css">
</head>'
printf'
<p>登録が完了しました。下記リンクからスタンプラリーカードを入手して下さい!</p>
<p><a href="hoge.rb"> >> Let\'s go to Stamp Rally << </a></p>
<p></p>
<p><a href="account.html"> >> アカウント登録画面に戻る << </a></p>
</body></html>
'

yatex.org