\n";
if ($filename)
{
if (preg_match("/\W/", $filename)) # Sjekk for stygge ting som "."!
{
echo "
Illegal characters in the \"Save as\" field.
\n";
echo "Use letters, digits and underscores only.";
}
elseif ($contents != "none")
{
# echo ":: $contents -> " . filesize($contents) . "
\n";
if (filesize($contents) > 5000)
{
echo "
The file is too large. Upload aborted.
\n";
}
elseif ($passwd[$password])
{
$filename2 = $passwd[$password] . "-$filename";
$filename3 = "/hom/arnesom/www_docs/wps/questions2/$filename2";
if (file_exists($filename3))
{
rename($filename3, $filename3 ."." . time());
# Rename any existing file with the same filename. #
}
if (copy($contents, $filename3))
{
menu_item("The question file has been successfully saved", "", "", "");
echo "Access it as q=$filename2";
echo " from the quiz-program.\n";
$success++;
}
else
{
echo "
Unable to open the specified file.
\n";
}
}
else
{
echo "Wrong password!
\n";
}
}
}
if (!$success)
{
menu_item("Usage", "", "", "
- Make a question file. It must be saved as plain text. The question
file syntax is described in the manual.
- Upload it to the system with this page.
- Run it through the quiz-program (with the supplied address) to check
for errors. Fix the file and repeat point 2 and 3 until you are
satisfied.
- Save the html-code and place it on your local web server.
");
menu_item("Upload Form:", "", "", "");
?>