diff --git a/shuzai/ice/.htaccess b/shuzai/ice/.htaccess new file mode 100644 index 0000000..d2f361b --- /dev/null +++ b/shuzai/ice/.htaccess @@ -0,0 +1,3 @@ +AddHandler cgi-script .rb +Options +ExecCGI +AddType "text/html; charset=utf-8" .html diff --git a/shuzai/ice/ajax.rb b/shuzai/ice/ajax.rb new file mode 100755 index 0000000..7e74e3f --- /dev/null +++ b/shuzai/ice/ajax.rb @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +require 'cgi' +require 'json' + +#moare = "moare.js" +#bchu = "bchu.js" + +c = CGI.new +s = c['shop'] +name = c['name'] +star = c['star'] +comment = c['comment'] +sjs = '' +inputs = {} + +if s == "moare" + sjs = 'moare.json' +elsif s == "bchu" + sjs = 'bchu.json' +end + +if star.to_i == 0 + star = 3 +elsif star.to_i > 5 + star = 5 +elsif star.to_i < 1 + star = 1 +end + +#p sjs +data = File.open(sjs) do |io| + JSON.load(io) +end +inputs["name"] = name +inputs["star"] = star +inputs["comment"] = comment + +if name != "" && star != "" && comment != "" +data.unshift(inputs) +end + +poi = File.open(sjs, "w") do |file| + str = JSON.dump(data, file) +end +#sleep(3) + +print "Content-type: text/plain; charset=UTF-8\n\n" + +#puts "#{s},#{name},#{star},#{comment}" +puts JSON.pretty_generate(data) diff --git a/shuzai/ice/babychuchu/ajax.rb b/shuzai/ice/babychuchu/ajax.rb new file mode 100755 index 0000000..7e74e3f --- /dev/null +++ b/shuzai/ice/babychuchu/ajax.rb @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +require 'cgi' +require 'json' + +#moare = "moare.js" +#bchu = "bchu.js" + +c = CGI.new +s = c['shop'] +name = c['name'] +star = c['star'] +comment = c['comment'] +sjs = '' +inputs = {} + +if s == "moare" + sjs = 'moare.json' +elsif s == "bchu" + sjs = 'bchu.json' +end + +if star.to_i == 0 + star = 3 +elsif star.to_i > 5 + star = 5 +elsif star.to_i < 1 + star = 1 +end + +#p sjs +data = File.open(sjs) do |io| + JSON.load(io) +end +inputs["name"] = name +inputs["star"] = star +inputs["comment"] = comment + +if name != "" && star != "" && comment != "" +data.unshift(inputs) +end + +poi = File.open(sjs, "w") do |file| + str = JSON.dump(data, file) +end +#sleep(3) + +print "Content-type: text/plain; charset=UTF-8\n\n" + +#puts "#{s},#{name},#{star},#{comment}" +puts JSON.pretty_generate(data) diff --git a/shuzai/ice/babychuchu/babychuchu.html b/shuzai/ice/babychuchu/babychuchu.html index b67a79b..2684ef7 100644 --- a/shuzai/ice/babychuchu/babychuchu.html +++ b/shuzai/ice/babychuchu/babychuchu.html @@ -10,8 +10,10 @@ --> + + - +

@@ -60,6 +62,21 @@

+
+
+
+
+
+
+

your name:

+

stars:/5

+

comments:
+

+ + +
+ +