Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require_gem 'activerecord'
- require_gem 'actionpack'
- ActiveRecord::Base.establish_connection(
- :adapter => 'mysql',
- :database => 'http_tracker',
- :username => '',
- :password => '',
- :socket => '/var/lib/mysql/mysql.sock'
- )
- class HttpTracker < ActiveRecord::Base
- set_table_name "http_tracker"
- end
- class Swf < ActionController::Base
- attr_accessor :swf_file
- def output
- @data = IO.read(swf_file)
- send_data(@data, :filename => 'my_player.swf', :type => 'application/x-shockwave-flash')
- end
- end
- tracker = HttpTracker.new(:host => ENV["HTTP_HOST"],
- :user_agent => ENV["HTTP_USER_AGENT"],
- :request_method => ENV["REQUEST_METHOD"],
- :remote_ip => ENV["REMOTE_ADDR"],
- :viewed_at => Time.now)
- tracker.save!
- swf = Swf.new
- swf.swf_file = File.join(Dir.getwd,'test.cgi')
- swf.output
Add Comment
Please, Sign In to add comment