Ruby/CGI/Cookie
Материал из Wiki.crossplatform.ru
(Различия между версиями)
Версия 17:10, 26 мая 2010
Setting Cookies and Other HTTP Response Headers
#!/usr/bin/ruby require "cgi" cgi = CGI.new("html3") cookie = cgi.cookies["yourCookie"] cookie = CGI::Cookie.new("yourCookie", "hits=0", "last=#{Time.now}") if cookie.empty? hits = cookie.value[0].split("=")[1] last = cookie.value[1].split("=")[1] cookie.value[0] = "hits=#{hits.succ}" cookie.value[1] = "last=#{Time.now}"