J
Jeff Leggett
So, I am trying ot read the contents of a file and format the contents
there into a CGI form. At 6PM on A friday hough, I am just not seeing
my errors - appreciate another srt of eyes!
require "cgi"
Filename = 'classification.txt'
EMPTY_STRING = ''
TITLE = 'Vulnerability Classification'
cgi = CGI.new('html4')
output = cgi.html do
cgi.head { cgi.title { TITLE } } +
cgi.body { cgi.h1 { TITLE } } +
cgi.form('post') do
if File.readable?(Filename) then
f = File.open(Filename,"r")
f.each_line { |l| l.chomp
inputs = l.split(',')
puts inputs[0].to_s + ": "
opts = "\"" + inputs[1].to_s + "\""
2.times { inputs.delete_at(0) }
until inputs.empty? do
opts = opts + "[\"" + inputs[1].to_s + "\",\"" +
inputs[0].to_s + "\"]"
2.times { inputs.delete_at(0) }
end
cgi.popup_menu(opts) +
cgi.br +
}
f.close
end
cgi.submit
end
end
cgi.out { output.gsub('><', ">\n<") }
there into a CGI form. At 6PM on A friday hough, I am just not seeing
my errors - appreciate another srt of eyes!
require "cgi"
Filename = 'classification.txt'
EMPTY_STRING = ''
TITLE = 'Vulnerability Classification'
cgi = CGI.new('html4')
output = cgi.html do
cgi.head { cgi.title { TITLE } } +
cgi.body { cgi.h1 { TITLE } } +
cgi.form('post') do
if File.readable?(Filename) then
f = File.open(Filename,"r")
f.each_line { |l| l.chomp
inputs = l.split(',')
puts inputs[0].to_s + ": "
opts = "\"" + inputs[1].to_s + "\""
2.times { inputs.delete_at(0) }
until inputs.empty? do
opts = opts + "[\"" + inputs[1].to_s + "\",\"" +
inputs[0].to_s + "\"]"
2.times { inputs.delete_at(0) }
end
cgi.popup_menu(opts) +
cgi.br +
}
f.close
end
cgi.submit
end
end
cgi.out { output.gsub('><', ">\n<") }