/** * Checking upload files to the server. * @return boolean * @static * @final */ public static final function FileUploads() { if (Server::PHPInterface() == 'cli' || Server::PHPFileUploads() === false || self::FileDeletion() === false) { return false; } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test.dat")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test.dat"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php"); } $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php", 'wb'); @fputs($file, "<?php\n" . "if (isset(\$_FILES['filename']) && is_uploaded_file(\$_FILES['filename']['tmp_name'])) {\n" . " @move_uploaded_file(\$_FILES['filename']['tmp_name'], \$_REQUEST['root'] . '/test.dat');\n" . " echo file_exists(\$_REQUEST['root'] . '/test.dat');\n" . "}\n" . '?>'); @fclose($file); $text = 'Test upload'; $boundary = sha1(1); $file = "--{$boundary}\r\n" . "Content-Disposition: form-data; name=\"filename\"; filename=\"test.dat\"\r\n" . "Content-Type: text/plain; charset=us-ascii\r\n" . "Content-Length: 11\r\n" . "Content-Type: application/octet-stream\r\n\r\n" . "{$text}\r\n" . "--{$boundary}--"; $body = 'POST ' . dirname($_SERVER['PHP_SELF']) . "/test_upload.php?root={$_SERVER['DOCUMENT_ROOT']} HTTP/1.1\r\n" . 'Host: ' . Tools::getHost() . "\r\n" . "Content-Type: multipart/form-data; boundary={$boundary}\r\n" . 'Content-Length: ' . strlen($file) . "\r\n" . "Connection: Close\r\n\r\n" . $file; $result = file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php") ? Tools::CreateRequest($body) : false; if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test.dat")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test.dat"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php"); } return $result; }
/** * Checking upload big files to the server. * @param integer $size * @return boolean * @static * @final */ public static final function UploadsBigFile($size = 1024) { global $count, $js; if (Server::PHPInterface() == 'cli' || Server::PHPFileUploads() === false || FileSystem::FileDeletion() === false) { return false; } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_big.dat")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_big.dat"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_big_uploader.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_big_uploader.php"); } $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php", 'wb'); @fputs($file, "<?php\n" . "if (isset(\$_FILES['filename']) && is_uploaded_file(\$_FILES['filename']['tmp_name'])) {\n" . " @move_uploaded_file(\$_FILES['filename']['tmp_name'], \$_REQUEST['root'] . '/test_big.dat');\n" . " echo file_exists(\$_REQUEST['root'] . '/test_big.dat');\n" . "}\n" . "@unlink(__FILE__);\n" . '?>'); @fclose($file); $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_big_uploader.php", 'wb'); @fputs($file, "<?php\n" . "ini_set('display_errors', false);\n" . "@error_reporting(-1);\n\n" . "\$text = str_repeat(str_repeat('*', 1023) . \"\\n\", {$size});\n" . "\$boundary = sha1(1);\n" . "\$file = \"--\$boundary\\r\\n\" .\n" . " \"Content-Disposition: form-data; name=\\\"filename\\\"; filename=\\\"test_big.dat\\\"\\r\\n\" .\n" . " \"Content-Type: text/plain; charset=us-ascii\\r\\n\" .\n" . " \"Content-Length: \" . (1024 * {$size}) . \"\\r\\n\" .\n" . " \"Content-Type: application/octet-stream\\r\\n\\r\\n\" .\n" . " \"\$text\\r\\n\" .\n" . " \"--\$boundary--\";\n\n" . "\$body = \"POST " . dirname($_SERVER['PHP_SELF']) . "/test_big_upload.php?root={$_SERVER['DOCUMENT_ROOT']} HTTP/1.1\\r\\n\" .\n" . " \"Host: " . Tools::getHost() . "\\r\\n\" .\n" . " \"Content-Type: multipart/form-data; boundary=\$boundary\\r\\n\" .\n" . " 'Content-Length: ' . strlen(\$file) . \"\\r\\n\" .\n" . " \"Connection: Close\\r\\n\\r\\n\" .\n" . " \$file;\n\n" . "if (file_exists(\"{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php\")) { \n" . " \$res = @fsockopen('" . Tools::getHost() . "', " . ($_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80) . ", \$errno, \$errstr, 3);\n" . " if (\$res) {\n" . " \$time = explode(' ', microtime());\n" . " \$time = (float) \$time[0] + (float) \$time[1];\n" . " fputs(\$res, \$body);\n" . " \$result = end(explode(\"\\n\", fread(\$res, 4096)));\n" . " fclose(\$res);\n" . " \$finishtime = explode(' ', microtime());\n" . " \$finishtime = (float) \$finishtime[0] + (float) \$finishtime[1];\n" . " \$time = round(\$finishtime - \$time, 2);\n" . " echo \$result == '1' ? \"Yes \$time s\" : 'No';\n" . " } else {\n" . " echo 'No';\n" . " }\n" . "} else {\n" . " echo 'No';\n" . "}\n" . "@unlink('{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php');\n" . "@unlink('{$_SERVER['DOCUMENT_ROOT']}/test_big.dat');\n" . "@unlink(__FILE__);\n" . '?>'); @fclose($file); $cnt = $count + 1; $js .= "\$('#value-{$cnt}').parent('tr').removeClass().addClass('active');\n" . "\$('#value-{$cnt}').siblings('.loader').html('<img src=\"https://www.crazydogtshirts.com/skin/frontend/mtcolias/default/images/loader.gif\"/>');\n" . "\$.get( \"" . dirname($_SERVER['PHP_SELF']) . "/test_big_uploader.php\", function(data) {\n" . " \$('#value-{$cnt}').siblings('.loader').children().remove();\n" . " \$('#value-{$cnt}').parent('tr').removeClass();\n" . " if (data == 'No' || data == '') {\n" . " \$('#value-{$cnt}').html(data);\n" . " \$('#value-{$cnt}').parent('tr').addClass('danger');\n\n" . " } else {\n" . " \$('#value-{$cnt}').html(data);\n" . " \$('#value-{$cnt}').parent('tr').addClass('success');\n\n" . " }\n" . "})\n" . ".fail(function() {\n" . " \$('#value-{$cnt}').siblings('.loader').children().remove();\n" . " \$('#value-{$cnt}').html('No');\n" . " \$('#value-{$cnt}').parent('tr').addClass('danger');\n" . "})\n"; return 'Wait'; }
$b->add('Perl Regex', Server::PerlRegex(), null, null, 'Checking perl regex.'); $b->add('Zlib', Server::Zlib(), null, null, 'Checking zlib.'); $b->add('GDlib', Server::GDlib(), null, null, 'Checking gdlib.'); $b->add('Free Type', Server::FreeType(), null, null, 'Checking free type.'); $b->add('Mbstring', Server::Mbstring(), null, null, 'Checking mbstring.'); $b->add('PDO', Server::PDO(), null, null, 'Checking PDO'); $b->add('SimpleXML', Server::SimpleXML(), null, null, 'Checking SimpleXML'); $b->add('DOMDocument', Server::DOMDocument(), null, null, 'Checking DOMDocument'); $b->add('Curl', Server::Curl(), null, null, 'Checking Curl'); $b->add('Memory Limit', Server::MemoryLimit(), null, null, 'Checking Memory Limit'); $b->add('Max Execution Time', Server::MaxExecutionTime(), null, null, 'Checking Max Execution Time'); $b->add('Umask', Server::Umask(), null, null, 'Finds and returns the umask.'); $b->add('Post Max Size', Server::PostMaxSize(), null, null, 'Finds and returns the post max size.'); $b->add('Register Globals', Server::RegisterGlobals(), null, null, 'Checking Register Globals.'); $b->add('Display Errors', Server::DisplayErrors(), null, null, 'Checking Display Errors.'); $b->add('PHP File Uploads', Server::PHPFileUploads(), null, null, 'Checking PHPFileUploads.'); $b->add('Server Time', Server::ServerTime(), null, null, 'Returns the current server time.'); $b->addHeader('High Load.'); $b->add('Actual Memory Limit', HighLoad::ActualMemoryLimit(), 128, '>', 'Checks the actual memory limit.'); $b->add('Number Cpu Operations', HighLoad::NumberCpuOperations(), null, null, 'Number of operations of the CPU.'); $b->add('Number File Operations', HighLoad::NumberFileOperations(), null, null, 'Number of file operations.'); $b->add('Actual Execution Time', HighLoad::ActualExecutionTime(50), null, null, 'Checks real-time execution of the script.'); $b->add('Sending Big Emails', HighLoad::SendingBigEmails(), null, null, 'Checking the sending big emails.'); $b->add('Uploads Big File', HighLoad::UploadsBigFile(1000), null, null, 'Checking upload big files to the server.'); $b->addHeader('Http server.'); $b->add('Server', Http::Server(), null, null, 'Finds the current http server.'); $b->add('Protocol', Http::Protocol(), null, null, 'Gets the protocol HTTP.'); $b->add('Real IP', Http::RealIP(), null, null, 'Gets real ip address of the server.'); $b->add('Authorization', Http::Authorization(), null, null, 'Checks authorization via http.'); $b->add('Sessions', Http::Sessions(), null, null, 'Checks work sessions via http.'); $b->add('SSL', Http::SSL('www.google.com'), null, null, 'Checks operation ssl via http.');