'0' && $allow) { if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"),0) == '0') { $query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageType`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) "; $query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$fstype', '$descr', '$size', '$units')"; mysql_query($query); if($debug) { echo("$query"); } echo("+"); } else { $data = mysql_fetch_array(mysql_query("SELECT * FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'")); if($data['hrStorageDescr'] != $descr || $data['hrStorageSize'] != $size || $data['hrStorageAllocationUnits'] != $units || $data['hrStorageType'] != $fstype) { $query = "UPDATE storage SET `hrStorageDescr` = '$descr', `hrStorageType` = '$fstype', `hrStorageSize` = '$size', `hrStorageAllocationUnits` = '$units' "; $query .= ", `hrStorageType` = '$fstype' "; $query .= "WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"; echo("U"); if($debug) { echo("$query \n"); } mysql_query($query); } else { echo("."); } } $storage_exists[] = $device['device_id']." $hrStorageIndex"; } else { echo("X"); }; } } $sql = "SELECT * FROM storage AS S, devices AS D where S.host_id = D.device_id AND D.device_id = '".$device['device_id']."'"; $query = mysql_query($sql); while ($store = mysql_fetch_array($query)) { unset($exists); $i = 0; while ($i < count($storage_exists) && !isset($exists)) { $thisstore = $store['host_id'] . " " . $store['hrStorageIndex']; if ($storage_exists[$i] == $thisstore) { $exists = 1; } $i++; } if(!$exists) { echo("-"); mysql_query("DELETE FROM storage WHERE storage_id = '" . $store['storage_id'] . "'"); } } echo("\n"); ?>