initial uploading capabilities
git-svn-id: http://yolanda.mister-muffin.de/svn@16 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
6a62362820
commit
13f42715e7
6 changed files with 56 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
use CGI qw(:standard);
|
||||
use CGI::Session;
|
||||
use CGI;
|
||||
use DBI;
|
||||
use XML::Simple qw(:strict);
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require "/var/www/perl/include.pl";
|
||||
|
||||
CGI::Session->name($session_name);
|
||||
$session = new CGI::Session;
|
||||
$query = new CGI;
|
||||
$session = new CGI::Session;
|
||||
|
||||
if($query->param('action')) {
|
||||
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
||||
|
@ -49,5 +49,4 @@ if($query->param('action')) {
|
|||
<input name="pass" type="password" size="30" maxlength="30">
|
||||
<input type="submit" name="login" value=" login ">
|
||||
</p></form>';
|
||||
print STDIN;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require "/var/www/perl/include.pl";
|
||||
|
||||
CGI::Session->name($session_name);
|
||||
$session = new CGI::Session;
|
||||
$query = new CGI;
|
||||
$session = new CGI::Session;
|
||||
|
||||
if($query->param('user') and $query->param('pass')) {
|
||||
$dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass);
|
||||
|
|
22
trunk/upload.pl
Normal file
22
trunk/upload.pl
Normal file
|
@ -0,0 +1,22 @@
|
|||
require "/var/www/perl/include.pl";
|
||||
require "/var/www/perl/functions.pl";
|
||||
|
||||
#create or resume session
|
||||
CGI::Session->name($session_name);
|
||||
my $session = new CGI::Session;
|
||||
|
||||
my $username = get_username_from_sid($session->id);
|
||||
|
||||
if($username) {
|
||||
print $session->header();
|
||||
print '<form action="uploader.pl" method="post" enctype="multipart/form-data">
|
||||
Upload: <input type="file" name="file">
|
||||
<br><br>
|
||||
Title: <input type="text" name="title">
|
||||
<br><br>
|
||||
<input type="submit" name="submit" value=" upload ">
|
||||
</form>';
|
||||
} else {
|
||||
print $session->header();
|
||||
print "nope...";
|
||||
}
|
30
trunk/uploader.pl
Normal file
30
trunk/uploader.pl
Normal file
|
@ -0,0 +1,30 @@
|
|||
require "/var/www/perl/include.pl";
|
||||
require "/var/www/perl/functions.pl";
|
||||
|
||||
CGI::Session->name($session_name);
|
||||
$query = CGI->new(\&hook);
|
||||
$session = new CGI::Session;
|
||||
#$query = new CGI;
|
||||
|
||||
sub hook {
|
||||
my ($filename, $buffer, $bytes_read, $data) = @_;
|
||||
open(TEMP, ">/var/www/perl/temp.temp") or die "cannot open";
|
||||
print TEMP "Read $bytes_read bytes of $filename\n";
|
||||
close TEMP;
|
||||
}
|
||||
|
||||
my $username = get_username_from_sid($session->id);
|
||||
|
||||
if($username) {
|
||||
my $filename = $query->param("file");
|
||||
my $title = $query->param("title");
|
||||
$upload_filehandle = $query->upload("file");
|
||||
print $session->header();
|
||||
while ( <$upload_filehandle> )
|
||||
{
|
||||
print;
|
||||
}
|
||||
} else {
|
||||
print $session->header();
|
||||
print "nope...";
|
||||
}
|
|
@ -73,7 +73,7 @@
|
|||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<div class="header1">
|
||||
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='upload_video']" /></a>
|
||||
<a href="upload.pl"><xsl:value-of select="$locale_strings/str[@id='upload_video']" /></a>
|
||||
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
||||
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='bookmarks']" /></a>
|
||||
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
||||
|
|
Loading…
Reference in a new issue