Mercurial > hgrepos > hgweb.cgi > skipweb
view opencampus2015/cookie.rb @ 2838:caa3a981a412
merge
author | ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp> |
---|---|
date | Tue, 01 Dec 2015 18:17:32 +0900 |
parents | 407cd06d2b73 48a1cdd1def3 |
children |
line wrap: on
line source
#!/usr/bin/env ruby22 # -*- coding: utf-8 -*- require 'sqlite3' require 'kconv' require 'cgi' c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") db = SQLite3::Database.new("sql/main.sq3") id = c.cookies["id"][0] id = nil expires = Time.now + 1 if id == nil end printf("Content-type: text/html; charset=UTF-8 Set-Cookie:id=%s ;expires=%s\n\n", id, expires) printf(<<_EOS_) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <meta name="format-detection" content="telephone=no"> <link media="only screen and (max-device-width:480px)" href="smart.css" type="text/css" rel="stylesheet" /> <link media="screen and (min-device-width:481px)" href="profeel.css" type="text/css" rel="stylesheet" /> <link rel="shortcut icon" href="./img/cabage.png"/> <title>Registering Account</title> </head> <body> <h1>Miyazac Quest</h1> <h2>記憶は消えた...</h2> <div class="f1"><div class="lets"> <a href="index.html">新しい記録を作成</a></div></div> </body></html> _EOS_