1 |
#!/usr/local/bin/perl |
2 |
|
3 |
BEGIN { $APP_PATH="/home/httpd/html/webmail/cgi-bin/"; } |
4 |
|
5 |
# @ ---------------------------------------------------------------------------------------------------------- |
6 |
# @ This code is (c) 1999 Alexandre Aufrere and NikoSoft. |
7 |
# @ Published under NPL rights, meaning you have the right |
8 |
# @ to use and modify this code freely, provided it |
9 |
# @ remains available and free. Any modified code should be |
10 |
# @ submitted to Nikopol Software Corp. or Alexandre Aufrere. |
11 |
# @ This code is protected by the French laws on Copyright. |
12 |
# @ Please note that there it comes with NO WARRANTY of any kind, |
13 |
# @ and especially for any damagbe it could cause to your computer |
14 |
# @ or network. |
15 |
# @ Using this code means you agree to this license agreement. |
16 |
# @ Further information at http://aufrere.citeweb.net/nsc/ |
17 |
# @ ---------------------------------------------------------------------------------------------------------- |
18 |
# @ |
19 |
# @ Project NS WebMail |
20 |
# @ |
21 |
# @ Filename sentmail.pl |
22 |
# @ |
23 |
# @ Description outbox manager for NS WebMail |
24 |
# @ |
25 |
# @ Version 1.0 |
26 |
# @ |
27 |
# @ ---------------------------------------------------------------------------------------------------------- |
28 |
|
29 |
require $APP_PATH."config.pl"; |
30 |
|
31 |
&ReadParse; |
32 |
$loginname = $in{'loginname'}; |
33 |
$password = $in{'password'}; |
34 |
$POPserver = $in{'POPserver'}; |
35 |
$lastMsg = $in{'lastMsg'}; |
36 |
$deleteMsg = $in{'deleteMsg'}; |
37 |
$cache = $in{'cache'}; |
38 |
|
39 |
#Begin production of HTML code. |
40 |
print "Content-type: text/html\n\n"; |
41 |
print "<HTML><HEAD><TITLE>NSWM Sent Mail Managment</TITLE>"; |
42 |
|
43 |
if ($cache eq "No") { print "<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>"; |
44 |
print "</HEAD>\n<BODY BGCOLOR='#FFFFFF'>"; |
45 |
} |
46 |
else { print "</HEAD>\n<BODY BGCOLOR='FF8F8F'>"; |
47 |
} |
48 |
|
49 |
print "<FORM METHOD='POST' ACTION='".$CGI_PATH_NSWM."sentmail.pl' name=sentForm>\n"; |
50 |
print "<INPUT TYPE='hidden' NAME='loginname' VALUE=$loginname>\n"; |
51 |
print "<INPUT TYPE='hidden' NAME='password' VALUE=$password>\n"; |
52 |
print "<INPUT TYPE='hidden' NAME='POPserver' VALUE=$POPserver>\n"; |
53 |
print "<INPUT TYPE='hidden' NAME='cache' VALUE=$cache>\n"; |
54 |
print "</FORM>"; |
55 |
|
56 |
print "<FORM METHOD='POST' ACTION='".$CGI_PATH_NSWM."inbox.pl' name=inboxForm >\n"; |
57 |
print "<INPUT TYPE='hidden' NAME='loginname' VALUE=$loginname >\n"; |
58 |
print "<INPUT TYPE='hidden' NAME='password' VALUE=$password >\n"; |
59 |
print "<INPUT TYPE='hidden' NAME='POPserver' VALUE=$POPserver >\n"; |
60 |
print "<INPUT TYPE='hidden' NAME='cache' VALUE=$cache >\n"; |
61 |
print "</FORM>"; |
62 |
|
63 |
print "<FORM METHOD='POST' ACTION='".$CGI_PATH_NSWM."sendform.pl' name=newMailForm>\n"; |
64 |
print "<INPUT TYPE='hidden' NAME='loginname' VALUE=$loginname>\n"; |
65 |
print "<INPUT TYPE='hidden' NAME='password' VALUE=$password>\n"; |
66 |
print "<INPUT TYPE='hidden' NAME='POPserver' VALUE=$POPserver>\n"; |
67 |
print "<INPUT TYPE='hidden' NAME='cache' VALUE=$cache>\n"; |
68 |
print "<INPUT TYPE='hidden' NAME='to' VALUE=''>\n"; |
69 |
print "<INPUT TYPE='hidden' NAME='subject' VALUE=''>\n"; |
70 |
print "</FORM>"; |
71 |
|
72 |
$logfilename=$LOG_PATH.$loginname."\@".$POPserver.".log"; |
73 |
open (f, "$logfilename"); |
74 |
@msgsentlist=<f>; |
75 |
close (f); |
76 |
|
77 |
@msgsentlist=reverse(@msgsentlist); |
78 |
|
79 |
$i=0; |
80 |
|
81 |
print "\n<table border=0 cellpadding=2 cellspacing=0 width=90% align=center>\n"; |
82 |
print "<tr bgcolor=darkblue><td><b><font color=white>$totext</b></td><td><b><font color=white>$subjecttext</b></td><td><b><font color=white>$datetext</b></td></tr>\n"; |
83 |
foreach $msg (@msgsentlist) { |
84 |
($msgdate,$msgto, $msgsubject)=split(";",$msg); |
85 |
if ( (($i)/2) == int(($i)/2) ) { |
86 |
print "<tr>\n"; |
87 |
} else { |
88 |
print "<tr bgcolor=lightblue>\n"; |
89 |
} |
90 |
print "<td>$msgto</td><td>$msgsubject</td><td>$msgdate</td></tr>\n"; |
91 |
$i++; |
92 |
} |
93 |
print "</table>"; |
94 |
|
95 |
print"</BODY></HTML>"; |
96 |
exit; |
97 |
|
98 |
|
99 |
############################################################################### |
100 |
sub ReadParse { |
101 |
local(*in)=@_ if @_; |
102 |
local ($i,$key,$val); |
103 |
|
104 |
if ($ENV{'REQUEST_METHOD'} eq "GET") { |
105 |
$in=$ENV{'QUERY_STRING'}; |
106 |
} |
107 |
elsif ($ENV{'REQUEST_METHOD'} eq "POST") { |
108 |
read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); |
109 |
} |
110 |
|
111 |
@in=split(/&/,$in); |
112 |
|
113 |
foreach $i (0 .. $#in) { |
114 |
$in[$i] =~ s/\+/ /g; |
115 |
($key,$val)=split(/=/,$in[$i],2); |
116 |
$key =~ s/%(..)/pack("c",hex($1))/ge; |
117 |
$val =~ s/%(..)/pack("c",hex($1))/ge; |
118 |
$in{$key} .= "\0" if (defined($in{$key})); |
119 |
$in{$key} .=$val; |
120 |
} |
121 |
return length($in); |
122 |
} |
123 |
|