#!E:/Perl/bin/perl -w
use CGI;
use strict 'refs';
use lib '..';
use CGI qw(:standard);
use CGI::Carp qw/fatalsToBrowser/;
use File::Copy;
$nick = param('nick');
$pass = param('pass');
$ip= remote_addr;
if(!($nick))
{
%user = cookie('pcwuser');
}
else
{
$user{'nick'}=$nick;
$user{'pass'}=$pass;
$user{'ip'}=$ip;
}
$the_cookie = cookie(-name=>'pcwuser',
-value=>\%user,
-expires=>"+1h");
#-----------Creating a New query----------------------
#-----------Print HTML-Header-------------------------
print header(-cookie=>$the_cookie);
print '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>HTTP-Kontrollzentrum</title>
<link rev="made" href="mailto:pcw@pcw.homeip.net" />
<meta name="keywords" content="Upload" />
<style media="screen" type="text/css"><!--
a:link{font-family:Tahoma,Arial;color:#ADF3FB;text-decoration:none}
a:hover{font-family:Tahoma,Arial;color:#ADF3FB;text-decoration:none}
a:active{font-family:Tahoma,Arial;color:#ADF3FB;text-decoration:none}
a:visited{font-family:Tahoma,Arial;color:#ADF3FB;text-decoration:none}
td{font-family:Tahoma,Arial;font-Size:11px;color:#ADF3FB;}
td.h{font-family:Tahoma,Arial;font-Size:14px;color:#ADF3FB;}
table {border-width:1px;
border-style:solid;
border-color:#c0dcdc;
padding:1cm;
text-align:justify; }
--></style>
</head>
<body bgcolor="#000c34" text="#619AB8">','<font face="Tahoma">';
print small(strong("Version "),$CGI::VERSION);
print "<center>",h2("HTTP-Kontrollzentrum"),
strong("Dieses Feature arbeitet erst ab Netscape 2.0, IE 4.0 oder neueren Versionen."),
p;
if ($user{'nick'})
{
open(IND,"<./../members/user.ind")||die "Konnte Userverzeichnis nicht öffnen!\n";
@file=<IND>;
close(IND);
my $i;
$no;
for ($i=1;$i<=$#file;$i++)
{
chomp($file[$i]);
if ($file[$i] eq $user{'nick'})
{
$no=$i;
}
}
if ($no!=0)
{
$user{'nick'}=$no;
}
$pfad="../members/$user{'nick'}/";
$url="http://pcwServer.de/pcw/members/$user{'nick'}/";
$script='http://pcwServer.de/pcw/cgi-bin/filecontrol.cgi';
$default_name = remote_addr;
# Start a multipart form.
print start_multipart_form(),
"<table><tr><th colspan=\"2\">$url</th></tr><tr><td class=\"h\">Dateiname: </td>\n<td>",
textfield('savefile',$default_name,30),reset,"</td>\n</tr><tr>\n<td class=\"h\">Datei: </td>\n<td>",
filefield('filename','',30),"</td>\n</tr><tr>\n",
"<td>Name:</td>\n",
"<td><input name=\"nick\" value=\"\" size=\"15\"></td></tr>\n",
"<tr><td>Passwort:</td>\n",
"<td><input type=\"password\" name=\"pass\" value=\"\" size=\"15\"></td></tr>\n<tr>\n",
"<td colspan=\"2\" align=\"center\">",submit('submit','Hochladen'),"</td>\n</tr>\n</table>\n",
endform;
# Process the form if there is a file name entered
if (my $file = param('filename'))
{
my $tmpfile=tmpFileName($file);
$savefile = param('savefile');
$savefile=~ s/\//-/gs;
$savefile = "$pfad$savefile";
[b] if(-e $savefile)
{
$n=0;
$ind=rindex($savefile,'.');
$savfile=substr($savefile,0,$ind);
$end=substr($savefile,$ind+1,length($savefile)-$ind);
while (-e "$savfile($n).$end")
{
$n++;
}
$savefile="$savfile($n).$end";
}[/b]
$savefile=~s/(((\.php)|(\.phps)|(\.phtml)|(\.pl)|(\.cgi))+)/\.script/gs;
chmod 0777, $savefile;
copy($tmpfile,$savefile);
}
if (my $del = param('del'))
{
$delfile="$pfad$del";
if(-e $delfile)
{
unlink($delfile);print "Datei ($del) gelöscht!\n";
}
else
{
print "Error: Kann $del nicht löschen. Datei existiert nicht!\n";
}
}
if (my $newname = param('newname'))
{
$newname=~s/(((\.php)|(\.phps)|(\.phtml)|(\.pl)|(\.cgi))+)/\.script/gs;
$new="$pfad$newname";
$rename=param('rename');
$re="$pfad$rename";
if(-e $re)
{
if(rename($re,$new))
{
print "$rename wurde erfolgreich umbenannt in $newname!\n";
}
else
{
print hr,"$!\n";
}
}
else
{
print "Error: Kann $re nicht umbenennen. Datei existiert nicht!\n";
}
}
&ShowPics;
}
else
{
print strong("Du bist nicht eingeloggt!\n");
}
print "</center>\n",end_html;
sub ShowPics
{
@file=<$pfad*>;
if(@file){
print "<table><tr><th>Dateien online:</th><th>Bytes</th><th>Löschen</th><th>Umbenennen</th>\n";
foreach(@file)
{
if(-f $_){
$size= -s $_;
$_=~ s/$pfad//gs;
if($_ ne lc("Thumbs.db"))
{
print "</tr><tr><td class=\"h\"><a href=\"$url$_\" target=\"_blank\">$_</a></td>
<td align=\"right\">$size</td>
<td><form method=\"post\" action=\"$script\" enctype=\"multipart/form-data\">
<input type=\"hidden\" name=\"del\" value=\"$_\"><input type=\"hidden\" name=\"nick\" value=\"$user{'nick'}\"><input type=\"hidden\" name=\"pass\" value=\"$user{'pass'}\"><input type=\"submit\" name=\"submit\" value=\"Löschen\">
</form></td>
<td><form method=\"post\" action=\"$script\" enctype=\"multipart/form-data\">
<input type=\"hidden\" name=\"rename\" value=\"$_\"><input type=\"hidden\" name=\"nick\" value=\"$user{'nick'}\"><input type=\"hidden\" name=\"pass\" value=\"$user{'pass'}\"><input type=\"text\" size=\"15\" name=\"newname\" value=\"$_\"><input type=\"submit\" name=\"submit\" value=\"Umbenennen\">
</form></td>\n";
}
}
}
print "</tr></table>\n";}
print hr;
}