if ($get == "NetExtIp") { $data["value"] = getExternalIP(); } else { if ($get == "all") { $memInfo = getMemInfo(); $i = 0; foreach ($config["Software"] as $key => $value) { $name = array_keys($value); $name = $name[0]; $process = $value[$name]; $data[$key] = $name . " " . CheckRunningProcess($process); $i++; } $data["HW_OS"] = getOperatingSystem(); $data["HW_KERNEL"] = getKernel(); $data["HW_CPU"] = getCPU(); $data["HW_RAM_USED"] = getSize($memInfo["MemTotal"] - $memInfo["MemFree"]); $data["HW_RAM_AVAIL"] = getSize($memInfo["MemTotal"]); $data["HW_RAM_PRNT"] = round(100 * ($memInfo["MemTotal"] - $memInfo["MemFree"]) / $memInfo["MemTotal"], 1); $data["HW_SWAP_USED"] = getSize($memInfo["SwapTotal"] - $memInfo["SwapFree"]); $data["HW_SWAP_AVAIL"] = getSize($memInfo["SwapTotal"]); $data["HW_SWAP_PRNT"] = round(100 * ($memInfo["SwapTotal"] - $memInfo["SwapFree"]) / $memInfo["SwapTotal"], 1); $data["NET_IP"] = getIP(); } else { die("ERROR1"); } } } } $data["CACHE"] = $cachetime; $data["TIMESTAMP"] = $time;
require '../lib/libparser.php'; $name = $_REQUEST['name']; $date = $_REQUEST['date']; $price = $_REQUEST['price']; sql('CREATE TABLE IF NOT EXISTS price( name VARCHAR(255), date DATE, price DOUBLE, PRIMARY KEY (name, date) )'); $cpu = parseCpuByName($name); $gpu = parseGpuByName($name); if (!$cpu && !$gpu) { die("Invalid CPU / GPU"); } if ($cpu && !getCPU($cpu)) { die("Unknown CPU"); } if ($gpu && !getGPU($gpu)) { die("Unknown GPU"); } $result = sql("SELECT * FROM price WHERE name = '{$name}' AND date = '{$date}'", 1); if ($result->num_rows > 0) { $exist = true; } else { $exist = false; } if (!$exist) { sql("INSERT INTO price(name, date, price) VALUES ('{$name}', '{$date}', {$price})"); echo "{$name} added successfully!<br>"; echo "{$date}: {$price}<br>";