2011年9月19日月曜日

CentOS5.7にRuby1.9.2インストール

■OSバンドルのRuby有無確認
[root@rails01 ~]# rpm -qa | grep ruby
[root@rails01 ~]#
⇒既存Rubyは存在しないのでOK!


■インストーラダウンロード
ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
smb経由でサーバのsrcディレクトリにアップロード。


■インストール
[root@rails01 ~]# cd /home/public/src/
[root@rails01 src]# tar -zxf ruby-1.9.2-p290.tar.gz
[root@rails01 src]# cd ruby-1.9.2-p290
[root@rails01 ruby-1.9.2-p290]# ./configure --prefix=/usr/local
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
(中略)
ruby library version = 1.9.1
configure: creating ./config.status
config.status: creating Makefile

[root@rails01 ruby-1.9.2-p290]# make
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initiali                                    zers -Wno-long-long -I. -I.ext/include/x86_64-linux -I./include -I. -DRUBY_EXPORT   -o main.o -c main.c
gcc -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initiali                                    zers -Wno-long-long -I. -I.ext/include/x86_64-linux -I./include -I. -DRUBY_EXPORT   -o dln.o -c dln.c
(中略:10分くらい)
Generating file member index...
Generating page index...
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  -e 'File.open("doc/capi/.timestamp", "w"){|f| f.puts(Time.now)}'

[root@rails01 ruby-1.9.2-p290]# make install
(中略)
installing manpages:          /usr/local/ruby/share/man/man1
installing default gems:      /usr/local/ruby/lib/ruby/gems/1.9.1 (cache, doc, gems, specifications)
                              rake 0.8.7
                              rdoc 2.5.8
                              minitest 1.6.0
⇒バージョン確認
[root@rails01 ~]# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
[root@rails01 ~]# gem -v
1.3.7


■Railsインストール
[root@rails01 ~]# gem install rails
Building native extensions.  This could take a while...
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed multi_json-1.0.3
Successfully installed activesupport-3.1.0
Successfully installed builder-3.0.0
Successfully installed i18n-0.6.0
Successfully installed bcrypt-ruby-3.0.1
Successfully installed activemodel-3.1.0
Successfully installed rack-1.3.3
Successfully installed rack-cache-1.0.3
Successfully installed rack-test-0.6.1
Successfully installed rack-mount-0.8.3
Successfully installed hike-1.2.1
Successfully installed tilt-1.3.3
Successfully installed sprockets-2.0.0
Successfully installed erubis-2.7.0
Successfully installed actionpack-3.1.0
Successfully installed arel-2.2.1
Successfully installed tzinfo-0.3.29
Successfully installed activerecord-3.1.0
Successfully installed activeresource-3.1.0
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.2
Successfully installed treetop-1.4.10
Successfully installed mail-2.3.0
Successfully installed actionmailer-3.1.0
Successfully installed thor-0.14.6
Successfully installed rack-ssl-1.3.2
Successfully installed rdoc-3.9.4
Successfully installed railties-3.1.0
Successfully installed bundler-1.0.18
Successfully installed rails-3.1.0
30 gems installed
Installing ri documentation for multi_json-1.0.3...
Installing ri documentation for activesupport-3.1.0...
Installing ri documentation for builder-3.0.0...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing ri documentation for i18n-0.6.0...
Installing ri documentation for bcrypt-ruby-3.0.1...
Installing ri documentation for activemodel-3.1.0...
Installing ri documentation for rack-1.3.3...
Installing ri documentation for rack-cache-1.0.3...
Installing ri documentation for rack-test-0.6.1...
Installing ri documentation for rack-mount-0.8.3...
Installing ri documentation for hike-1.2.1...
Installing ri documentation for tilt-1.3.3...
Installing ri documentation for sprockets-2.0.0...
Installing ri documentation for erubis-2.7.0...
Installing ri documentation for actionpack-3.1.0...
Installing ri documentation for arel-2.2.1...
Installing ri documentation for tzinfo-0.3.29...
Installing ri documentation for activerecord-3.1.0...
Installing ri documentation for activeresource-3.1.0...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for polyglot-0.3.2...
Installing ri documentation for treetop-1.4.10...
Installing ri documentation for mail-2.3.0...
Installing ri documentation for actionmailer-3.1.0...
Installing ri documentation for thor-0.14.6...
Installing ri documentation for rack-ssl-1.3.2...
Installing ri documentation for rdoc-3.9.4...
Installing ri documentation for railties-3.1.0...
Installing ri documentation for bundler-1.0.18...
Installing ri documentation for rails-3.1.0...
file 'lib' not found
Installing RDoc documentation for multi_json-1.0.3...
Installing RDoc documentation for activesupport-3.1.0...
Installing RDoc documentation for builder-3.0.0...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing RDoc documentation for i18n-0.6.0...
Installing RDoc documentation for bcrypt-ruby-3.0.1...
Installing RDoc documentation for activemodel-3.1.0...
Installing RDoc documentation for rack-1.3.3...
Installing RDoc documentation for rack-cache-1.0.3...
Installing RDoc documentation for rack-test-0.6.1...
Installing RDoc documentation for rack-mount-0.8.3...
Installing RDoc documentation for hike-1.2.1...
Installing RDoc documentation for tilt-1.3.3...
Installing RDoc documentation for sprockets-2.0.0...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for actionpack-3.1.0...
Installing RDoc documentation for arel-2.2.1...
Installing RDoc documentation for tzinfo-0.3.29...
Installing RDoc documentation for activerecord-3.1.0...
Installing RDoc documentation for activeresource-3.1.0...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for polyglot-0.3.2...
Installing RDoc documentation for treetop-1.4.10...
Installing RDoc documentation for mail-2.3.0...
Installing RDoc documentation for actionmailer-3.1.0...
Installing RDoc documentation for thor-0.14.6...
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for rdoc-3.9.4...
Installing RDoc documentation for railties-3.1.0...
Installing RDoc documentation for bundler-1.0.18...
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found

⇒バージョン確認
[root@rails01 ~]# rails --version
Rails 3.1.0


■サンプルプロジェクト作成
[root@rails01 ~]# mkdir rails_projects
[root@rails01 ~]# cd rails_projects/
[root@rails01 rails_projects]# rails new sample -d mysql
      create
      create  README
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  test/fixtures
      create  test/fixtures/.gitkeep
      create  test/functional
      create  test/functional/.gitkeep
      create  test/integration
      create  test/integration/.gitkeep
      create  test/unit
      create  test/unit/.gitkeep
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Fetching source index for http://rubygems.org/
Installing rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.3)
Using rack-cache (1.0.3)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.0)
Using actionpack (3.1.0)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.0)
Using arel (2.2.1)
Using tzinfo (0.3.29)
Using activerecord (3.1.0)
Using activeresource (3.1.0)
Installing ansi (1.3.0)
Using bundler (1.0.18)
Installing coffee-script-source (1.1.2)
Installing execjs (1.2.6)
Installing coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.9.4)
Using thor (0.14.6)
Using railties (3.1.0)
Installing coffee-rails (3.1.1)
Installing jquery-rails (1.0.14)
Installing mysql2 (0.3.7) with native extensions
Using rails (3.1.0)
Installing sass (3.1.7)
Installing sass-rails (3.1.2)
Installing turn (0.8.2)
Installing uglifier (1.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
[root@rails01 rails_projects]#


■データベース準備
[root@rails01 ~]# /etc/init.d/mysqld start
MySQL を起動中:                                            [  OK  ]

⇒プロジェクトディレクトリに移動してデータベース作成
[root@rails01 ~]# cd /root/rails_projects/sample/
[root@rails01 sample]# rake db:create
(in /root/rails_projects/sample)
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.6/lib/execjs/runtimes.rb:46:in `autodetect'
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.6/lib/execjs.rb:5:in `'
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.6/lib/execjs.rb:4:in `'
(中略)
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `
' ⇒上記エラー対応のためGemfile修正 [root@rails01 sample]# vi Gemfile [root@rails01 sample]# head Gemfile source 'http://rubygems.org' gem 'rails', '3.1.0' # add 20110919 gem 'therubyracer' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' [root@rails01 sample]# bundle update Fetching source index for http://rubygems.org/ (中略) Installing therubyracer (0.9.4) with native extensions Using turn (0.8.2) Using uglifier (1.0.3) Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed. ⇒再びデータベース作成 [root@rails01 sample]# rake db:create (in /root/rails_projects/sample) rake aborted! uninitialized constant Rake::DSL /usr/local/lib/ruby/1.9.1/rake.rb:2482:in `const_missing' (後略) ⇒上記エラー対応のためGemfile修正 [root@rails01 sample]# vi Gemfile [root@rails01 sample]# head Gemfile source 'http://rubygems.org' gem 'rails', '3.1.0' # add 20110919 gem 'therubyracer' gem 'rake', '0.8.7' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' [root@rails01 sample]# bundle update Fetching source index for http://rubygems.org/ Using rake (0.8.7) Using multi_json (1.0.3) (後略) ⇒再びデータベース作成 [root@rails01 sample]# rake db:create (in /root/rails_projects/sample) [root@rails01 sample]# mysqlshow +--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | sample_development | | sample_test | | test | +--------------------+ データベースが作成された!! ■Webサーバ起動 [root@rails01 sample]# rails s => Booting WEBrick => Rails 3.1.0 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2011-09-19 22:43:01] INFO WEBrick 1.3.1 [2011-09-19 22:43:01] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux] [2011-09-19 22:43:01] INFO WEBrick::HTTPServer#start: pid=12327 port=3000 または、 [root@rails01 sample]# rails s > log/WEBrick.log & [1] 25595 ■ブラウザで確認 http://192.168.1.14:3000/

2011年9月18日日曜日

CentOS5.7バンドルのMySQL

★RubyOnRailsのデータベースとしてMySQLを準備

■OSバンドルのmysqlモジュール確認
[root@rails01 ~]# rpm -qa | grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-5.0.77-4.el5_6.6
mysql-server-5.0.77-4.el5_6.6
mysql-5.0.77-4.el5_6.6
mysql-connector-odbc-3.51.26r1127-1.el5
⇒mysql-develがない!

■mysql-develインストール
[root@rails01 ~]# yum install mysql-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.i386 0:5.0.77-4.el5_6.6 set to be updated
---> Package mysql-devel.x86_64 0:5.0.77-4.el5_6.6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                       Arch                     Version                            Repository              Size
========================================================================================================================
Installing:
 mysql-devel                   i386                     5.0.77-4.el5_6.6                   base                   2.4 M
 mysql-devel                   x86_64                   5.0.77-4.el5_6.6                   base                   2.5 M

Transaction Summary
========================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 4.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): mysql-devel-5.0.77-4.el5_6.6.i386.rpm                                                     | 2.4 MB     00:01
(2/2): mysql-devel-5.0.77-4.el5_6.6.x86_64.rpm                                                   | 2.5 MB     00:00
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   2.1 MB/s | 4.9 MB     00:02
警告: rpmts_HdrFromFdno: ヘッダ V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey                                                                                      | 1.5 kB     00:00
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mysql-devel                                                                                      1/2
  Installing     : mysql-devel                                                                                      2/2

Installed:
  mysql-devel.i386 0:5.0.77-4.el5_6.6                       mysql-devel.x86_64 0:5.0.77-4.el5_6.6

Complete!
[root@rails01 ~]# rpm -qa | grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-5.0.77-4.el5_6.6
mysql-devel-5.0.77-4.el5_6.6
mysql-server-5.0.77-4.el5_6.6
mysql-5.0.77-4.el5_6.6
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-devel-5.0.77-4.el5_6.6


■データベース初期化
[root@rails01 ~]# /etc/init.d/mysqld start
MySQL データベースを初期化中:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h rails01 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
MySQL を起動中:                                            [  OK  ]

⇒起動確認
[root@rails01 ~]# mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+

⇒停止
[root@rails01 ~]# /etc/init.d/mysqld stop
MySQL を停止中:                                            [  OK  ]

2011年9月17日土曜日

CentOS5.7インストールパッケージ

★RubyOnRails用として仮想サーバをCentOSで構築。
⇒MySQLはOSバンドルを利用予定。
⇒RubyおよびRailsは最新版をインストール予定。

■OSインストール時のパッケージ選択
-----------------------------------------------------------
【デスクトップ環境】
 ■ GNOMEデスクトップ環境
 □ KDE(Kデスクトップ環境)

【アプリケーション】
 □ Emacs
 □ Office/生産性
 ■ エディタ
 ■ グラフィカルインターネット
 ■ グラフィクス
 □ ゲームと娯楽
 ■ サウンドとビデオ
 □ テキストベースのインターネット
 □ 技術系と科学系
 □ 著作権と発行

【開発】
 □ GNOMEソフトウェア開発
 ■ Java開発
 □ KDEソフトウェア開発
 □ Ruby
 □ Xソフトウェア開発
 ■ レガシーなソフトウェアの開発
 ■ 開発ツール
 ■ 開発ライブラリ

【サーバー】
 □ DNSネームサーバー
 ■ FTPサーバー
 ■ MySQLデータベース
 □ PostgreSQLデータベース
 ■ Webサーバー
 ■ Windowsファイルサーバー
 ■ サーバー設定ツール
 □ ニュースサーバー 
 □ ネットワークサーバー
 □ メールサーバー
 □ レガシーなネットワークサーバー
 □ 印刷サポート

【ベースシステム】
 ■ Java
 ■ OpenFabrics Enterprise ディストリビューション
 ■ X Window System
 ■ システムツール
 □ ダイヤルアップネットワークサポート
 ■ ベース
 ■ レガシーなソフトウェアのサポート
 ■ 管理ツール

【仮想化】
 □ KVM
 □ 仮想化

【クラスタリング】
 □ クラスタリング

【クラスタストレージ】
 □ クラスタストレージ

【言語】
 ■ 日本語のサポート

2011年6月28日火曜日

cookie検証

[root@tanyao0b cgi-bin]# cat login.cgi
#!/usr/bin/perl

#フォームからの受け取りをデコードする
&dec;

#クッキーの読み出し
&splt;

#入室用のパスワード
$passw = '0123';

#入力されたパスが正しければ
if ($forminh{'pass'} eq $passw) { &site_form; }

#cookieのパスが正しければ
elsif ($COOKIE{'ckpas'} eq $passw) { &site_cookie; }

# 初期アクセス
print <<"HTML";
Content-type: text/html








統合監視システムへようこそ!
パスワード:
HTML exit; #入力されたパスが正しければ表示するサイトのサブルーチン sub site_form { #クッキーの書き出し print <<"HTML"; Content-type: text/html Set-Cookie: ckpas=$forminh{'pass'}; expires=Tue, 1-Jan-2030 00:00:00 GMT; path=/cgi-bin/; HTML print <<"HTML"; Content-type: text/html site_form 統合監視システムへログイン成功!!
Get from COOKIE: $ENV{'HTTP_COOKIE'}
Get from FORM: $forminh{'pass'}

下記リンクをクリックするとこのページをリロードします。
login.cgi
HTML exit; } #cookieのパスが正しければ表示するサイトのサブルーチン sub site_cookie { print <<"HTML"; Content-type: text/html site_cookie こちらは、統合監視システムです。すでに認証済みです。
Get from COOKIE: $ENV{'HTTP_COOKIE'}
Get from FORM: $forminh{'pass'}

ログアウトはこちら
HTML exit; } #フォームからの値をデコードするサブルーチン sub dec { #フォームからデータを受け取り変数へ入れる read(STDIN, $formin, $ENV{'CONTENT_LENGTH'}); # + 記号を半角スペースに戻す $formin =~ tr/+/ /; #URLエンコードデータをデコード $formin =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; @indata = split (/&/,$formin); #受け取ったデータを&で区切り、配列へ foreach $tmp (@indata) #フォームの要素分(配列分)以下の処理を繰り返す { ($name,$value) = split (/=/,$tmp); # =記号で区切り、名前 と 値 に分ける $forminh{$name} = $value; #区切った名前を付けた連想配列に値を入れる } } #クッキー読み出し用のサブルーチン sub splt { @cookdata = split(/;/,$ENV{'HTTP_COOKIE'}); #クッキーを配列に foreach $tmp (@cookdata) #クッキーデータの有る間処理をする { ($youso,$atai) = split(/=/,$tmp); #要素名と値に区切る $youso =~ s/ //; #要素間のスペース除去 $COOKIE{$youso} = $atai; #要素名の連想配列に値を入れる } } [root@tanyao0b cgi-bin]# cat logout.cgi #!/usr/bin/perl #クッキーの読み出し &splt; #入室用のパスワード $passw = '0123'; #cookieのパスが正しければ if ($COOKIE{'ckpas'} eq $passw) { &site_cookie; } # 初期アクセス print <<"HTML"; Content-type: text/html 認証に失敗している可能性があります。

認証画面はこちら
HTML exit; #cookieのパスが正しければ表示するサイトのサブルーチン sub site_cookie { #クッキーの書き出し print <<"HTML"; Content-type: text/html Set-Cookie: ckpas= ; expires=Tue, 1-Jan-2020 00:00:00 GMT; path=/cgi-bin/; HTML print <<"HTML"; Content-type: text/html site_cookie ログアウトしました。

Get from COOKIE: $ENV{'HTTP_COOKIE'}
Get from FORM: $forminh{'pass'}
Delete Password from Cookie !!

ログイン画面はlogin.cgi
HTML exit; } #クッキー読み出し用のサブルーチン sub splt { @cookdata = split(/;/,$ENV{'HTTP_COOKIE'}); #クッキーを配列に foreach $tmp (@cookdata) #クッキーデータの有る間処理をする { ($youso,$atai) = split(/=/,$tmp); #要素名と値に区切る $youso =~ s/ //; #要素間のスペース除去 $COOKIE{$youso} = $atai; #要素名の連想配列に値を入れる } }

2011年6月14日火曜日

smbセッションキャッシュクリア

--------------------------------------------------
同じユーザーによる、サーバーまたは共有リソースへの複数のユーザー名での複数の接続は許可されません。
サーバーまたは共有リソースへの以前の接続をすべて切断してから、再試行してください。
--------------------------------------------------
上記のようなメッセージが表示され、smb領域のディレクトリにアクセスできない場合
コマンドプロンプトから解消可能。

C:\Documents and Settings\Administrator>net use
新しい接続は記憶されます。


ステータス ローカル名 リモート名 ネットワーク名

-------------------------------------------------------------------------------
OK \\192.168.188.54\files_bk Microsoft Windows Network
\\TSCLIENT\C Microsoft Terminal Services
\\TSCLIENT\D Microsoft Terminal Services
\\TSCLIENT\S Microsoft Terminal Services
コマンドは正常に終了しました。


C:\Documents and Settings\Administrator>net use \\192.168.188.54\files_bk /delete

\\192.168.188.54\files_bk が削除されました。