Beispiel #1
0
 /**
  * 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';
 }
Beispiel #2
0
 /**
  * Checks work local redirect via http.
  * @param integer $status
  * @return boolean
  * @static
  * @final
  */
 public static final function LocalRedirect($status = 301)
 {
     $statuses = array(300, 301, 302, 303, 304, 305, 307);
     if (Server::PHPInterface() == 'cli' || FileSystem::FileDeletion() === false || in_array($status, $statuses) == false) {
         return false;
     }
     if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php")) {
         @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php");
     }
     $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php", 'wb');
     @fputs($file, "<?php\n" . "if (\$_GET['local'] != 'Y') {\n" . "    header('Location: ' . dirname(\$_SERVER['PHP_SELF']) . '/test_redirect.php?local=Y', true, {$status});\n" . "}\n" . '?>');
     @fclose($file);
     $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80;
     $host = ($port == 443 ? 'https://' : 'http://') . ($_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : 'localhost');
     $result = file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php") ? get_headers($host . dirname($_SERVER['PHP_SELF']) . '/test_redirect.php') : false;
     if (is_array($result)) {
         $result = stripos(reset($result), $status) ? true : false;
     }
     if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php")) {
         @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php");
     }
     return $result;
 }
Beispiel #3
0
$b->add('SSL', Http::SSL('www.google.com'), null, null, 'Checks operation ssl via http.');
$b->add('SSL Lib Version', Http::SSLLibVersion(), null, null, 'Checks ssl Version.');
$b->add('Local Redirect', Http::LocalRedirect(), null, null, 'Checks work local redirect via http.');
$b->addHeader('File system.');
$b->add('Disk Space', FileSystem::DiskSpace(), '255', '<', 'Checking disk space.');
$b->add('Permissions Folder', FileSystem::PermissionsFolder(), '0777', '>', 'Checking access rights to the folder.');
$b->add('Folder Creation', FileSystem::FolderCreation(), true, '=', 'Checking folder creation.');
$b->add('Folder Deletion', FileSystem::FolderDeletion(), true, '=', 'Checking delete the folder.');
$b->add('Permissions Folder Creation', FileSystem::PermissionsFolderCreation(), null, null, 'Checking access rights to the new folder.');
$b->add('File Creation', FileSystem::FileCreation(), null, null, 'Checking file creation.');
$b->add('File Deletion', FileSystem::FileDeletion(), true, '=', 'Checking delete the file.');
$b->add('Permissions File Creation', FileSystem::PermissionsFileCreation(), null, null, 'Checking access rights to the new file.');
$b->add('File Execution', FileSystem::FileExecution(), true, '=', 'Checking the execution file.');
$b->add('Processing Htaccess', FileSystem::ProcessingHtaccess(), true, '=', 'Checking processing htaccess.');
$b->add('Time To Create 1000 File', FileSystem::TimeToCreateFile(1000), 1, '<', 'Checking the time required to create the file.');
$b->add('File Uploads', FileSystem::FileUploads(), null, null, 'Checking upload files to the server.');
if (isset($platformdb['driver']) && isset($platformdb['host']) && isset($platformdb['user']) && isset($platformdb['password']) && isset($platformdb['dbname'])) {
    $db = new DB($platformdb['user'], $platformdb['password'], $platformdb['dbname'], $platformdb['host'], $platformdb['driver']);
    $b->addHeader('Data Base.');
    $b->add('Version', $db->Version());
    $b->add('UpTime', $db->UpTime(), null, null, 'Working time database startup.');
    $b->add('Global Buffers', $db->GlobalBuffers(), null, null, 'Size of global buffers.');
    $b->add('Connection Buffers', $db->ConnectionBuffers(), null, null, 'Single connection buffer size.');
    $b->add('Sql Mode', $db->SqlMode());
    $b->add('Max Connections', $db->MaxConnections(), null, null, 'Max. connections.');
    $b->add('Max Memory Usage', $db->MaxMemoryUsage(), null, null, 'Maximum memory usage.');
    $b->add('Request Cache Size', $db->RequestCacheSize(), null, null, 'Request cache size.');
    $b->add('Request Cache Effectiveness', $db->RequestCacheEffectiveness(), null, null, 'Request cache effectiveness.');
    $b->add('Request Cache Prunes', $db->RequestCachePrunes(), null, null, 'Number of pruned requests.');
    $b->add('Sorts', $db->Sorts(), null, null, 'Total sorts.');
    $b->add('Sorts Temporary Tables', $db->SortsTemporaryTables(), null, null, 'Rate of sort operations requiring creating temporary tables on the disk.');