(j3.2006) Can't upload papers

Van Snyder Van.Snyder
Fri May 27 16:37:01 EDT 2011


I can't upload papers to the server.

I get a full page message.  Is it me, or is the server broken?

Van

'; $debug = 0; if ($debug) { echo 'Here is some more debugging info:';
print_r($_FILES); print_r($_POST); } $userfilename =
$_FILES['userfile']['name']; $uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($userfilename) ; $uploadfile =
str_replace(" ","_",$uploadfile); if (ereg(".php",
strtolower($userfilename))) { echo "Error: Cannot upload scripts\n";
exit; } // see if we have a "new" text file (need a new paper #). If
not, its one of // a revision, or a different format, or a standing
paper # $txtfile = strpos($userfilename, ".txt", strlen($userfilename) -
6); if (! $txtfile ) { echo "\nSorry, you can only upload .txt files
with this script\n"; echo "Please use upload2 for non-text files\n";
exit; } if ( $txtfile && ! ereg ("[0-9]{2}\-[0-9]{3}r[0-9]",
$userfilename) && ! ereg ("[0-9]{2}\-0[0-9]{2}", $userfilename) )
{ $revision = ""; } else { $revision = $userfilename ; }; $standing =
ereg ("[0-9]{2}\-0[0-9]{2}", $userfilename); if ( ! move_uploaded_file
( $_FILES['userfile']['tmp_name'], $uploadfile )) { echo "error moving
" . $_FILES['userfile']['tmp_name'] . " to " . $uploadfile . "\n";
exit; } // call dos2unix if we have a text file if ( $txtfile ) { echo
"Calling dos2unix\n"; $cmd = "/usr/bin/dos2unix " . $uploadfile; } //
chmod file to 777 $cmd = "/bin/chmod 777 $uploadfile"; exec($cmd); if
( $revision != "" && !standing) { // if this is a revision paper, see if
corresponding original paper exists $tf = substr($userfilename, 0, 6) .
".txt"; $cmd = "/bin/ls /home/librarian/fortran/HTML/doc/meeting/*/" .
$tf . " 2>&1"; $text = exec ($cmd); if (strpos($text, " No such file or
directory")) { echo "Error: Corresponding text file ($tf) does not exist
\n"; exit; } } // if this is a revision or standing paper, // make sure
this paper does not already exist if ( $revision != "") { $cmd =
"/bin/ls /home/librarian/fortran/HTML/doc/meeting/*/" . $userfilename .
" 2>&1"; $text = exec ($cmd); if (!strpos($text, " No such file or
directory")) { echo "Error: file $userfilename already exists: $text\n";
exit; } } $usepaper = 1; if ($usepaper) { if ( $revision == "" )
{ $cmd="/home/librarian/bin/paper " . $uploadfile . " 2>&1"; } else
{ $cmd="/home/librarian/bin/paper " . $uploadfile . " " . $revision . "
2>&1"; } if ($debug) { echo "About to call " . $cmd; echo "\n"; }
$status = exec ($cmd); if ( ereg("ERROR:", $status) ) { echo "Upload
Failed\n$status "; exit; } else { $url = "$status"; $url = strstr($url,
"/doc/"); $pn = basename($url); $url = "http://j3-fortran.org" . $url;
$urltxt = " $url"; echo " Upload complete, url is\n $urltxt \n"; $pn =
substr($pn, 0, strrpos($pn,".")); echo " Your paper # is $pn \n";
include ("/home/librarian/fortran/HTML/newpaper.inc"); newpaper($pn,
$url); } } else { } // // now see if its a standing document, and if so,
update the link in // doc/standing for this standing document // if
(ereg ("[0-9]{2}\-0[0-9]{2}", $userfilename) ) { echo "Updating standing
document link for $userfilename\n"; $n = strrpos($userfilename, "."); if
($n<=0) { echo "Misformed filename ($userfilename)\n"; exit; } $suffix =
substr($userfilename, $n+1, 999); $bn = substr($userfilename, 3, 3);
$targetfile= "/home/librarian/fortran/HTML" . strstr($url, "/doc/");
$cmd = "ln -s " . $targetfile . " " .
"/home/librarian/fortran/HTML/doc/standing/links/" . $bn . "." .
$suffix; exec($cmd); echo "Also updated link for standing paper\n"; }
print ""; ?> 




More information about the J3 mailing list