<?
$_SITE_ROOT = "root";
require_once("global.php");
//Begin Check ServerLoad
function get_server_load($windows = false) {
	$os = strtolower(PHP_OS);
    if(strpos($os, "win") === false) {
    if(file_exists("/proc/loadavg")) {
     $load = file_get_contents("/proc/loadavg");
     $load = explode(' ', $load);
        return $load[0];
            }
          elseif(function_exists("shell_exec")) {
              $load = explode(' ', `uptime`);
           return $load[count($load)-1];
         }
       else {
         }
       }
     elseif($windows) {
          if(class_exists("COM")) {
              $wmi = new COM("WinMgmts:\\\\.");
              $cpus = $wmi->InstancesOf("Win32_Processor");

             $cpuload = 0;
             $i = 0;
              while ($cpu = $cpus->Next()) {
                   $cpuload += $cpu->LoadPercentage;
                   $i++;
               }

               $cpuload = round($cpuload / $i, 2);
               return "$cpuload%";
           }
           else {
               return false;
           }
       }
}

function server_busy($numer){
   if (PHP_OS == 'Linux' && @file_exists('/proc/loadavg') && $filestuff = @file_get_contents('/proc/loadavg')){
       $loadavg = explode(' ', $filestuff);
       if (trim($loadavg[0]) > $numer)    {
           print 'sorry, server busy, ....';
           exit(0);
           }
       }
   }

//$srv = server_busy(8);
//End Check ServerLoad

require_once(DIR_INCLUDES."/clsRewrite.php");
require_once(NVCMS_DIR."/www/index.php");
?>