#!/usr/mesh/bin/perl # # program name : conv.cgi (convert) # # function : convert from text string to encoded text. # # programmer : makoto takenaka : takesoft@mxs.meshnet.or.jp # # copyright : (C) 1997 by Takesoft # # version(date): # 1.0(Jan 6, 1997) # # calling form : input next line in URL box of browser. # # http://www2a.meshnet.or.jp/~user-id/xxx/conv.cgi?text=abc123 # #(1) Send header and first part of Web page. # print "Content-type: text/html\n\n"; print < conv

conv

EOF # #(2) Get parameters from string. # if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } # @pairs = split(/&/, $buffer); # foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $parameters{$name} = $value; } # $text = $parameters{'text'}; # #(3) Set $s2. # @array = (a..z, A..Z, 0..9, '.', '/'); srand(time|$$); $i1 = int(rand(64)); $i2 = int(rand(64)); $s2 = $array[$i1].$array[$i2]; # #(4) Set $coded. # $coded = crypt($text, $s2); print "

Coded = $coded

\n"; # print "\n"; #