|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
schema/hackathon_2007/cgi-bin upload_game.pl, 1.2, 1.3Update of /cvsroot/gmod/schema/hackathon_2007/cgi-bin
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv18567 Modified Files: upload_game.pl Log Message: writing directly back to apollo now works; just need a config file for all the options now Index: upload_game.pl =================================================================== RCS file: /cvsroot/gmod/schema/hackathon_2007/cgi-bin/upload_game.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** upload_game.pl 13 Jul 2008 12:46:53 -0000 1.2 --- upload_game.pl 19 Jul 2008 15:34:24 -0000 1.3 *************** *** 17,21 **** %config = $conf->getall }; ! my $AUTOLOAD = $config{'autoload'} || 0; my $STORE_DIR = $config{'store_dir'} || "/usr/local/gmod/tmp/apollo"; --- 17,21 ---- %config = $conf->getall }; ! my $AUTOLOAD = $config{'autoload'} || 1; my $STORE_DIR = $config{'store_dir'} || "/usr/local/gmod/tmp/apollo"; *************** *** 58,62 **** $cgi->p("Config stuff: autoload:$AUTOLOAD, store_dir:$STORE_DIR"), - "file contents:", $cgi->hr, "<pre>\n"; --- 58,61 ---- *************** *** 64,94 **** my $fh = $cgi->upload( 'fileupload' ); while (<$fh>) { ! print; } if ($AUTOLOAD) { ! print $cgi->p("Autoload is not yet supported"); ! } ! else { #save the file for later ! die "ERROR: the store directory isn't configured" unless $STORE_DIR; ! my ($s, $ms) = gettimeofday; ! my $filename = "$s.$ms.".param('fileupload'); ! my $fullfilename = $STORE_DIR . "/" . $filename; ! open OUT, ">$fullfilename" or die "couldn't open file: $!"; ! seek $fh, 0, 0; #can be removed after debug prints are removed ! while (<$fh>) { ! print OUT $_; ! } ! close OUT; ! print $cgi->p(param('fileupload')." was written to $fullfilename"); ! #now write username and password ! my $userinfofile = $fullfilename.".userinfo"; ! open OUT, ">$userinfofile" or die "couldn't open file $!"; ! print OUT $cgi->param('username')."\n"; ! print OUT $cgi->param('password')."\n"; ! close OUT; } --- 63,96 ---- my $fh = $cgi->upload( 'fileupload' ); + die "ERROR: the store directory isn't configured" unless $STORE_DIR; + my ($s, $ms) = gettimeofday; + my $filename = "$s.$ms.".param('fileupload'); + my $fullfilename = $STORE_DIR . "/" . $filename; + open OUT, ">$fullfilename" or die "couldn't open file: $!"; + #seek $fh, 0, 0; #can be removed after debug prints are removed while (<$fh>) { ! print OUT $_; } + close OUT; + print $cgi->p(param('fileupload')." was written to $fullfilename"); + #now write username and password + my $userinfofile = $fullfilename.".userinfo"; + my $username = $cgi->param('username'); + my $password = $cgi->param('password'); + open OUT, ">$userinfofile" or die "couldn't open file $!"; + print OUT "$username\n"; + print OUT "$password\n"; + close OUT; + if ($AUTOLOAD) { ! my $apollo = "/home/gmod/downloads/apollo/bin/apollo.headless"; ! my $hostname = url(-base=>1); ! $ENV{PATH} = '/usr/java/jdk1.5.0_14/bin:/usr/bin:/bin'; ! my $javacmd = "$apollo -f $fullfilename -i game -o chadoDB"; ! print "writing to the database; here's the command:\n$javacmd\n"; ! system($javacmd); } ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gmod-schema-cmts mailing list Gmod-schema-cmts@... https://lists.sourceforge.net/lists/listinfo/gmod-schema-cmts |
| Free Forum Powered by Nabble | Forum Help |