changeset 1637:0e84991c0ac6

クイズプログラムを追加
author houtin <c115080@g.koeki-u.ac.jp>
date Tue, 25 Jul 2017 19:40:32 +0900
parents 627562e59fb6
children 3f34b6640416
files event/oasis2017/quiz/cookie.rb event/oasis2017/quiz/db/cal.db event/oasis2017/quiz/db/database
diffstat 3 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/event/oasis2017/quiz/cookie.rb	Tue Jul 25 19:40:32 2017 +0900
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+require 'yaml/store'
+file = "db/point.yaml"
+
+require 'cgi'
+c = CGI.new(:accept_charset => "UTF-8")
+
+# ≪祉鴻ф≪cookie絎臂緇
+# 吟cookiec.cookies[紊医][0] у
+cookie_id=c.cookies["id"][0]
+
+# ≪祉鴻уュゃ緇
+form_name=c["playname"]        # name若緇()
+form_kwd=c["keyword"]          # keyword緇()
+
+
+if cookie_id == nil             # (1)cookieid井域
+  # 域id憜祉腱(to_i)絖(to_s)箙掩違腟水
+  newid = Time.now.to_i.to_s + "/" + rand(99999).to_s
+  id=newid                      # 域idid
+else                            # (2)cookieid違id
+  id=cookie_id
+end
+
+# idcookieх御吟
+# 紊違24荐絎expire紊違ャ
+expire = (Time.now+24*3600).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
+printf("Content-type: text/html; charset=UTF-8\n")
+printf("Set-Cookie: id=%s; expires=%s\n\n", id, expire)
Binary file event/oasis2017/quiz/db/cal.db has changed
Binary file event/oasis2017/quiz/db/database has changed

yatex.org