#!/usr/bin/perl
#!E:/Program Files 2000/Programming/Compiler/Perl/ActivePerl/bin/perl.exe
binmode STDIN;
binmode STDOUT;
#=========================================================================
#・ソフト名称 WebMailClient2 for Keitai
#・作者 Lunar Night
#・バージョン 1.1.2
#・対応OS WinNT/UNIX系OS (Perl5 + Socket CGIが正常に動作すること)
#・種別 フリーソフト(ただし、商用利用の場合は規模により料金頂きます
#・概要 携帯でPOP3/SMTPメールを読み書きします
#・連絡先 lunar-night@par.odn.ne.jp
#=========================================================================
#詳しくはReadme.txt参照
#------各種設定--------#
$conf_make = 'wm_keitai_sys'; #---システムセッティング
$version = '1.1.2'; #---バージョン情報(変更しないで!)
$copy_right = '
LunarNight Lab.
LunarNight
';
#------ライブラリ設定--------#
$sys_page_dir = './conf/' ;
$main_page_dir = './design/' ;
$conf_dir = './sysdata/';
$lib_jcode = './lib/jcode.pl' ; #---日本語変換ライブラリ
$lib_general = './lib/general.pl' ; #---汎用ライブラリ
$lib_mail = './lib/mailcontrol.pl' ; #---MAILコントローラー
$lib_design = './lib/design_ctl.pl' ; #---デザインコントローラー
$lib_common = './lib/common.pl' ; #---共通ライブラリ
$lib_crypt = './lib/encrypt.pl' ; #---簡易暗号化ライブラリ
$lib_mimew = './lib/mimew.pl' ; #---MIMEエンコーダー
$lib_mimer = './lib/mimer.pl' ; #---MIMEデコーダー
$lib_md5 = './lib/md5.pl' ; #---MD5ハッシングモジュール
$lib_des = './lib/des.pl' ; #---DES暗号化モジュール
#------以下メインロジック--------#
require $lib_common ; #---共通ライブラリ
&load_lib($lib_jcode );
&load_lib($lib_general);
&load_lib($lib_des );
&load_lib($lib_md5 );
&load_lib($lib_crypt );
&load_lib($lib_design );
&load_lib($lib_mimer );
&load_lib($lib_mimew );
#---暗号化シード設定
$crypt_seed = $ENV{'SCRIPT_NAME'};
$crypt_seed .= $ENV{'HTTP_USER_AGENT'};
$crypt_seed .= 'gGTSDW6s6d$#%&"JK';
&encrypt('set_pass',$crypt_seed);
#---ファイル名設定
($tmp) = $0 =~ /([^\/\\]+)$/;
$filename = $tmp;
#---システムセッティング
&design_ctl("set",$sys_page_dir ,$conf_dir,"main::error","DesignControl");
&design_ctl("load",$conf_make);
&design_ctl("set",$main_page_dir,$conf_dir,"main::error","DesignControl");
#---STDIN読み込み
%in = ();
&read_stdin(*in);
#---保存情報確認
if ($in{'seed'} ne ""){
$rand_seed = $in{'seed'};
#---復号化
($data) = &execute('passctl','get',$rand_seed);
$in{'usr'} = $data;
}
#---アカウント情報読み込み
$enc = $in{'usr'};
&execute('account','get',$enc) if $enc ne '';
$relogin = "再ログイン";
#------------条件分岐--------------#
if ($in{'login' } ne ''){ &execute('dsp_main' ,1 );}
elsif($in{'exec_del' } ne ''){ &execute('exec_del' ,'dsp_main');}
elsif($in{'exec_send'} ne ''){ &execute('exec_send','dsp_scmp');}
elsif($in{'dsp_send' } ne ''){ &execute('dsp_send' );}
elsif($in{'dsp_res' } ne ''){ &execute('dsp_send' ,1 );}
elsif($in{'dsp_tr' } ne ''){ &execute('dsp_send' ,2 );}
elsif($in{'dsp_main' } ne ''){ &execute('dsp_main' );}
elsif($in{'dsp_mpage'} ne ''){ &execute('dsp_main' );}
elsif($in{'dsp_next' } ne ''){ &execute('dsp_main' );}
elsif($in{'dsp_back' } ne ''){ &execute('dsp_main' );}
elsif($in{'dsp_first'} ne ''){ &execute('dsp_main' );}
elsif($in{'dsp_last' } ne ''){ &execute('dsp_main' );}
elsif($in{'dsp_info' } ne ''){ &execute('dsp_info' );}
elsif($in{'dsp_nobj' } ne ''){ &execute('dsp_obj' ,1 );}
elsif($in{'dsp_bobj' } ne ''){ &execute('dsp_obj' ,-1 );}
elsif($in{'dsp_fobj' } ne ''){ &execute('dsp_obj' ,-2 );}
elsif($in{'dsp_lobj' } ne ''){ &execute('dsp_obj' ,-3 );}
elsif($in{'dsp_obj' } ne ''){ &execute('dsp_obj' );}
elsif($in{'dsp_mnext'} ne ''){ &execute('dsp_read' );}
elsif($in{'dsp_mback'} ne ''){ &execute('dsp_read' );}
elsif($in{'dsp_bback'} ne ''){ &execute('dsp_read',-1 );}
elsif($in{'dsp_bnext'} ne ''){ &execute('dsp_read', 1 );}
elsif($in{'dsp_body' } ne ''){ &execute('dsp_read','','body' );}
elsif($in{'dsp_head' } ne ''){ &execute('dsp_read','','head' );}
elsif($in{'dsp_bf' } ne ''){ &execute('dsp_read',-2 );}
elsif($in{'dsp_bl' } ne ''){ &execute('dsp_read',-3 );}
elsif($in{'dsp_read' } ne ''){ &execute('dsp_read' );}
elsif($in{'dsp_save' } ne ''){ &execute('dsp_save' );}
elsif($in{'dsp_save2'} ne ''){ &execute('dsp_save2' );}
elsif($in{'dsp_save3'} ne ''){ &execute('dsp_save3' );}
else { &execute('dsp_login' );}
exit;