false, "error" => "Error: You have not permissions to read the ".$tableName." table's data"); echo "
".printJSON($returnJSON)."
"; return; } $pSet = new ProjectSettings(GetTableByShort($tableName), $pageType); $denyChecking = $pSet->allowDuplicateValues( $fieldName ); if( $denyChecking ) { $returnJSON = array("success" => false, "error" => "Duplicated values are allowed"); echo "
".printJSON($returnJSON)."
"; return; } $cipherer = new RunnerCipherer($tableName, $pSet); if( $cipherer->isFieldEncrypted($fieldName) ) $value = $cipherer->MakeDBValue($fieldName, $value, $fieldControlType, "", true); else $value = make_db_value($fieldName, $value, $fieldControlType, "", $tableName); $where = GetFullFieldName($fieldName, $tableName, false).( $value == "null" ? ' is ' : '=' ).$value; $sql = "SELECT count(*) from ".AddTableWrappers( $pSet->getOriginalTableName() )." where ".$where; $rs = db_query($sql, $conn); if( !$rs || !($data = db_fetch_numarray($rs)) ) { $returnJSON = array("success" => false, "error" => "Error: Wrong SQL query"); echo "
".printJSON($returnJSON)."
"; return; } $hasDuplicates = $data[0] ? true : false; $returnJSON = array("success" => true, "hasDuplicates" => $hasDuplicates, "error"=>""); echo "
".printJSON($returnJSON)."
"; return; ?>