eurysco

eurysco is a free and open source project based on PHP language, in order to enhance and simplify the remote administration of Microsoft operating systems with an intuitive, fast and responsive web interface

view my linkedin profileview my linkedin profile :)

Privacy Policy
     

Total sweet donations $23
Help me to support eurysco (^_^) !

Source upload





0001 <?php
0002 
0003 include(str_replace('\\server', '', $_SERVER['DOCUMENT_ROOT']) . '\\include\\init_server.php');
0004 
0005 set_time_limit(60);
0006 
0007 if (isset($_POST['type']) && isset($_FILES['file'])) {
0008 	if ($_FILES['file']['error'] > 0) {
0009 	} else {
0010 		if ($_FILES['file']['size'] > 1048576) {
0011 		} else {
0012 			if ($_POST['type'] == 'nodes') {
0013 				$nodespath = $euryscoinstallpath . '\\nodes';
0014 				$moveerrorlevel = @move_uploaded_file($_FILES['file']['tmp_name'], $nodespath . '\\' . $_POST['node'] . '\\' . $_FILES['file']['name']);
0015 				if (isset($_POST['comp']) && file_exists($nodespath . '\\' . $_POST['node'] . '\\' . $_FILES['file']['name']) . '.xml.gz') {
0016 					$fp = '';
0017 					$fp = gzopen($nodespath . '\\' . $_POST['node'] . '\\' . $_FILES['file']['name'], 'rb');
0018 					$bl = '';
0019 					while (!feof($fp)) {
0020 						$gz = gzread($fp, 2048);
0021 						$bl = $bl . $gz;
0022 					}
0023 					fclose($fp);
0024 					$db = new SQLite3($euryscoinstallpath . '\\sqlite\\euryscoServer');
0025 					$db->busyTimeout(30000);
0026 					$db->query('PRAGMA page_size = 2048; PRAGMA cache_size = 4000; PRAGMA temp_store = 2; PRAGMA journal_mode = OFF; PRAGMA synchronous = 0;');
0027 					$hashingfile = hash_file('md5', $nodespath . '\\' . $_POST['node'] . '\\' . $_FILES['file']['name']);
0028 					$filename = str_replace('.xml.gz', '', $_FILES['file']['name']);
0029 					if (is_null($db->querySingle('SELECT node FROM nodesHash WHERE node = "' . strtolower($_POST['node']) . '"'))) {
0030 						$db->query('INSERT INTO nodesHash (node, ' . strtolower($filename) . ') VALUES ("' . strtolower($_POST['node']) . '", "' . $hashingfile . '")');
0031 					} else {
0032 						$db->query('UPDATE nodesHash SET ' . strtolower($filename) . ' = "' . $hashingfile . '" WHERE node = "' . strtolower($_POST['node']) . '"');
0033 					}
0034 					if (is_null($db->querySingle('SELECT node FROM xml' . ucfirst(strtolower($filename)) . ' WHERE node = "' . strtolower($_POST['node']) . '"'))) {
0035 						$db->query('INSERT INTO xml' . ucfirst(strtolower($filename)) . ' (node, xml) VALUES ("' . strtolower($_POST['node']) . '", "' . $bl . '")');
0036 					} else {
0037 						$db->query('UPDATE xml' . ucfirst(strtolower($filename)) . ' SET xml = "' . $bl . '" WHERE node = "' . strtolower($_POST['node']) . '"');
0038 					}
0039 					$db->close();
0040 					foreach (glob($euryscoinstallpath . '\\metering\\*.' . $filename . '_metering', GLOB_NOSORT) as $meteringname) {
0041 						$checkfind = 0;
0042 						$meteringfname = str_replace($euryscoinstallpath . '\\metering\\', '', $meteringname);
0043 						if (!file_exists($nodespath . '\\' . $_POST['node'] . '\\' . $meteringfname)) {
0044 							$bl = urldecode($bl);
0045 							$xml = simplexml_load_file($meteringname);
0046 							$meteringfilter = base64_decode($xml->filter);
0047 							if (substr($meteringfilter, 0, 1) != '-') {
0048 								if (preg_match_all('/' . str_replace('\\', '.', str_replace('/', '.', strtolower($meteringfilter))) . '/', strtolower($bl)) || strpos(strtolower($bl), strtolower($meteringfilter)) > -1) {
0049 									$checkfind = 0;
0050 								} else {
0051 									$checkfind = 1;
0052 								}
0053 							} else {
0054 								$notfind = substr($meteringfilter, 1);
0055 								if (!preg_match_all('/' . str_replace('\\', '.', str_replace('/', '.', strtolower($notfind))) . '/', strtolower($bl)) && !strpos(strtolower($bl), strtolower($notfind))) {
0056 									$checkfind = 0;
0057 								} else {
0058 									$checkfind = 1;
0059 								}
0060 							}
0061 							if($checkfind == 0) {
0062 								$fp = fopen($nodespath . '\\' . $_POST['node'] . '\\' . $meteringfname, 'w');
0063 								fwrite($fp, '');
0064 								fclose($fp);
0065 							}
0066 						}
0067 					}
0068 				}
0069 			}
0070 		}
0071 	}
0072 }
0073 
0074 
0075 
0076 foreach (get_defined_vars() as $key=>$val) {
0077 	if ($key != '_GET' && $key != '_POST' && $key != '_COOKIE' && $key != '_FILES' && $key != '_SERVER' && $key != '_SESSION' && $key != '_ENV') {
0078 		$$key = null;
0079 		unset($$key);
0080 	}
0081 }
0082 
0083 if (extension_loaded('zlib')) { ob_end_flush(); }
0084 
0085 ?>