comparison 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
comparison
equal deleted inserted replaced
544:de44297cdfaf 545:785e500c8003
1 #!/usr/bin/env ruby 1 #!/usr/bin/env ruby
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 #require 'sqlite3' 4 require 'sqlite3'
5 require 'cgi' 5 require 'cgi'
6 6
7 c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") 7 c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8")
8 #db = SQLite3::Database.new("sql/stump.sq3") 8 db = SQLite3::Database.new("sql/stump.sq3")
9 9
10 print("Content-type: text/html; charset=UTF-8 \n\n") 10 begin
11 result = db.execute("select * from main;")
12 rescue
13 db.execute("create table main(id PRIMARY KEY,name,sex,age,aria,job,stamp_status,stamp_img,exp,rank,magic)");
14 db.execute("insert into main values('ID','名前','性別','年代','住所','職業','スタンプ状況','スタンプ画像','レベル','当選順位','本人確認用')");
15 result = db.execute("select * from main");
16 end
11 17
12 name = c["name"] 18 name = c["name"]
13 job = c["job"] 19 job = c["job"]
14 sex = c["sex"] 20 age = c["age"]
21 sex = c["sex"]
22 aria = c["aria"]
15 23
16 print' 24 id = result.length
17 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 25 printf("%04d",id)
26
27 mg = 0
28
29 sql = "insert into main values (?,?,?,?,?,?,?,?,?,?,?);"
30 db.execute(sql,id,name,aria,sex,age,job,'000010000','n,n,n,n,kamo,n,n,n,n','0','0',mg); #初期値
31
32 printf("Set-Cookie:id=%d; magic=%s\n",id,mg)
33 print"Content-type: text/html; charset=UTF-8 \n\n"
34
35 print'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
18 "http://www.w3.org/TR/html4/strict.dtd"> 36 "http://www.w3.org/TR/html4/strict.dtd">
19
20 <html> 37 <html>
21 <head> 38 <head>
22 <title>Registering Account</title> 39 <title>Registering Account</title>
23 <link rel="stylesheet" type="text/css" href="design.css"> 40 <link rel="stylesheet" type="text/css" href="design.css">
24 </head> 41 </head>'
25 '
26 printf' 42 printf'
27 <p>登録が完了しました。下記リンクからスタンプラリーカードを入手して下さい!</p> 43 <p>登録が完了しました。下記リンクからスタンプラリーカードを入手して下さい!</p>
28 <p><a href="hoge.rb?%s+%s+%s"> >> Let\'s go to Stamp Rally << </a></p> 44 <p><a href="hoge.rb"> >> Let\'s go to Stamp Rally << </a></p>
29 ',name,job,sex
30 print'
31 <p></p> 45 <p></p>
32 <p><a href="account.html"> >> アカウント登録画面に戻る << </a></p> 46 <p><a href="account.html"> >> アカウント登録画面に戻る << </a></p>
47 </body></html>
33 ' 48 '
34 print'</body></html>'

yatex.org