1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| <?php
include('connection.php');
$q = mysql_query("SELECT * FROM qc_xml ORDER BY id_qc DESC limit 1;") or die('Erreur de la requête MySQL');
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\r\n";
while ($row = mysql_fetch_array($q)) {
$xml .= '<Endpoint UseAsQuery="'.$row["Query"].'">'."\r\n";
$xml .= '<Type>'.'QC'.'</Type>'."\r\n";
$xml .= '<EpName>'.$row['Epname'].'</EpName>'."\r\n";
$xml .='<ConnectionData>'."\r\n";
$xml .= '<Username>'.$row['Username'].'</Username>'."\r\n";
$xml .= '<password encrypted="'.$row['radio'].'" value="'.$row['valeur'].'"/>'."\r\n";
$xml .= '<Properties>'."\r\n";
$xml .= '<property name="Domain" value="'.$row['domain'].'"/>'."\r\n";
$xml .= '<property name="Project" value="'.$row['project'].'"/>'."\r\n";
$xml .= '</Properties>'."\r\n";
$xml .= '</ConnectionData>'."\r\n";
$xml .= '<Filters>'."\r\n";
//$xml .= '<filter field="'.$row['filter_field'].'" value="'.$row['valeur'].'"/>'."\r\n";
// ----
$array_filter_operator = explode('<br />',nl2br($row['filter_field']));
$array_field = explode('<br />',nl2br($row['valeur_c']));
foreach($array_filter_operator as $key => $val) {
$xml .= '<filter field="'.trim($array_filter_operator[$key]).'" value="'.trim($array_field[$key]).'" />'."\r\n";
}
// ----
$xml .= '</Filters>'."\r\n";
$xml .= '<FieldToGet IDName="'.$row['idname'].'">'."\r\n";
// ----
$array_field = explode('<br />',nl2br($row['field']));
foreach($array_field as $key => $val) {
$xml .= '<Field>'.trim($array_field[$key]).'</Field>'."\r\n";
}
// ----
$xml .= '</FieldsToGet>'."\r\n";
} // fin while
$xml .= '</Endpoint>'."\r\n";
$file = "D:/CQIET/wamp/www/projet_NDS/configuration/fichier_xml/".$fichier.".txt";
$current= $xml;
file_put_contents($file,$current);
?>
<script language="javascript">
alert("enregister"); </script> <?php include("QC_xml.php");exit; |
Partager