Ruby/CGI/Cookie
Материал из Wiki.crossplatform.ru
Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
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}"