Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/divers/findAccountRadiusProfile.php
<?php
include_once('../../config.inc.php');
if (!isset($_SESSION['oreon'])) Session::Start();
$oreon=$_SESSION['oreon'];
$user=$_GET["radiusprofile"];
$loc=$_GET["loc"];

if ($user!='')
	$result = $_SESSION["oreon"]->database->database->query("SELECT rp_name,rp_description FROM radiusprofile_template WHERE rp_name REGEXP ('$user') AND location_id='$loc'");
else
$result = $_SESSION["oreon"]->database->database->query("SELECT rp_name,rp_description FROM radiusprofile_template WHERE  location_id='$loc'");

//Création du flux XML et du fichier XML en utilisant DOM
 $dom = new DomDocument('1.0');

 //ajout de l’élément principal - <books>
 $acct = $dom->appendChild($dom->createElement('acctprofiles'));

 //ajout de l’élément <book> à l’élement <books>
$user = $acct->appendChild($dom->createElement('acctprofile'));


 while ($row = $oreon->database->database->fetch_object($result)) {
 $name = $user->appendChild($dom->createElement('name'));
 $name->appendChild($dom->createTextNode($row->rp_name));
 $bp = $user->appendChild($dom->createElement('description'));
 $bp->appendChild($dom->createTextNode($row->rp_description));
 $user = $acct->appendChild($dom->createElement('acctprofile'));

}

//génération du flux xml
 $dom->formatOutput = true; // définition du format de sortie à « true »
// Sauvegarde de l’XML en tant que flux texte ou fichier
 $str = $dom->saveXML(); // sauvegarde du flux dans la varialbe $test1
echo $str;
?>
Return current item: phpMyPrepaid