mirror of
https://github.com/Rouji/single_php_filehost.git
synced 2025-04-10 19:08:45 +00:00
moved code to pretty file up a bit
This commit is contained in:
parent
fad7869109
commit
e60c3131b6
58
index.php
58
index.php
@ -16,32 +16,6 @@ $HTTP_PROTO="https"; //protocol to use in links
|
|||||||
$ADMIN_EMAIL="complaintsgo@here.com"; //address for inquiries
|
$ADMIN_EMAIL="complaintsgo@here.com"; //address for inquiries
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// check php.ini settings and print warnings if anything's not configured
|
|
||||||
// properly
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
function checkConfig()
|
|
||||||
{
|
|
||||||
global $MAX_FILESIZE;
|
|
||||||
global $UPLOAD_TIMEOUT;
|
|
||||||
warnConfig('upload_max_filesize', "MAX_FILESIZE", $MAX_FILESIZE);
|
|
||||||
warnConfig('post_max_size', "MAX_FILESIZE", $MAX_FILESIZE);
|
|
||||||
warnConfig('max_input_time', "UPLOAD_TIMEOUT", $UPLOAD_TIMEOUT);
|
|
||||||
warnConfig('max_execution_time', "UPLOAD_TIMEOUT", $UPLOAD_TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
function warnConfig($iniName, $varName, $varValue)
|
|
||||||
{
|
|
||||||
$iniValue = intval(ini_get($iniName));
|
|
||||||
if ($iniValue < $varValue)
|
|
||||||
printf("<pre>Warning: php.ini: %s (%s) set lower than %s (%s)\n</pre>",
|
|
||||||
$iniName,
|
|
||||||
$iniValue,
|
|
||||||
$varName,
|
|
||||||
$varValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// decide what to do, based on POST parameters etc.
|
// decide what to do, based on POST parameters etc.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -61,8 +35,8 @@ else if (isset($argv[1]) && //file was called from cmd, to purge old files
|
|||||||
}
|
}
|
||||||
else //nothing special going on, print info text
|
else //nothing special going on, print info text
|
||||||
{
|
{
|
||||||
checkConfig();
|
checkConfig(); //check for any php.ini config problems
|
||||||
printInfo();
|
printInfo(); //print info page
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -80,6 +54,32 @@ function rndStr($len)
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// check php.ini settings and print warnings if anything's not configured
|
||||||
|
// properly
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
function checkConfig()
|
||||||
|
{
|
||||||
|
global $MAX_FILESIZE;
|
||||||
|
global $UPLOAD_TIMEOUT;
|
||||||
|
warnConfig('upload_max_filesize', "MAX_FILESIZE", $MAX_FILESIZE);
|
||||||
|
warnConfig('post_max_size', "MAX_FILESIZE", $MAX_FILESIZE);
|
||||||
|
warnConfig('max_input_time', "UPLOAD_TIMEOUT", $UPLOAD_TIMEOUT);
|
||||||
|
warnConfig('max_execution_time', "UPLOAD_TIMEOUT", $UPLOAD_TIMEOUT);
|
||||||
|
}
|
||||||
|
function warnConfig($iniName, $varName, $varValue)
|
||||||
|
{
|
||||||
|
$iniValue = intval(ini_get($iniName));
|
||||||
|
if ($iniValue < $varValue)
|
||||||
|
printf("<pre>Warning: php.ini: %s (%s) set lower than %s (%s)\n</pre>",
|
||||||
|
$iniName,
|
||||||
|
$iniValue,
|
||||||
|
$varName,
|
||||||
|
$varValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// store an uploaded file, given its name and temporary path, (e.g. values
|
// store an uploaded file, given its name and temporary path, (e.g. values
|
||||||
// straight out of $_FILES)
|
// straight out of $_FILES)
|
||||||
@ -144,6 +144,7 @@ function getExtension($path)
|
|||||||
return $ext;
|
return $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// purge all files older than their retention period allows.
|
// purge all files older than their retention period allows.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -204,6 +205,7 @@ function purgeFiles()
|
|||||||
$totalSize);
|
$totalSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// print a plaintext info page, explaining what this script does and how to
|
// print a plaintext info page, explaining what this script does and how to
|
||||||
// use it, how to upload, etc.
|
// use it, how to upload, etc.
|
||||||
|
Loading…
Reference in New Issue
Block a user