-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite_squadxml.php
69 lines (43 loc) · 1.74 KB
/
write_squadxml.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
INCLUDE 'setup.php' ;
$squadRawData = "";
//XML header
$squadxmlHeader = '<?xml version="1.0"?>'."\n".'<!DOCTYPE squad SYSTEM "squad.dtd">'."\n".'<?xml-stylesheet href="squad.xsl?" type="text/xsl"?>';
$query = "SELECT * FROM squad";
if($result = $database->query($query))
{
while($row = $result->fetch())
{
$fileNamePrefix = $row["s_filenameprefix"];
$fp = fopen($path_dir.$urlDoc."_".$fileNamePrefix.".xml", "w");
$squadRawData = $squadxmlHeader."\n";
$squadRawData .= '<squad nick="'.$row["s_nick"].'">'."\n";
$squadRawData .= ' <name>'.$row["s_name"].'</name>'."\n";
$squadRawData .= ' <email>'.$row["s_email"].'</email>'."\n";
$squadRawData .= ' <web>'.$row["s_web"].'</web>'."\n";
$squadRawData .= ' <picture>'.$row["s_picture"].'</picture>'."\n";
$squadRawData .= ' <title>'.$row["s_title"].'</title>'."\n";
//member
$query2 = "SELECT * FROM member WHERE m_member_whichsquad = '".$row["id"]."'";
if($result2 = $database->query($query2))
{
while($row2 = $result2->fetch())
{
$squadRawData .= ' <member id="'.$row2["m_member_id"].'" nick="'.$row2["m_member_nick"].'">'."\n";
$squadRawData .= ' <name>'.$row2["m_member_name"].'</name>'."\n";
$squadRawData .= ' <email>'.$row2["m_member_email"].'</email>'."\n";
$squadRawData .= ' <icq>'.$row2["m_member_icq"].'</icq>'."\n";
$squadRawData .= ' <remark>'.$row2["m_member_remark"].'</remark>'."\n";
$squadRawData .= ' </member>'."\n";
}
}
//end of squad
$squadRawData .= '</squad>';
fwrite($fp, $squadRawData);// Write the data to the file
fclose($fp);// Close the file
//Reset variables
$squadRawData = "";
}
}
//echo '<td><a href="'.curPageURL().'/xmlf/squad_'.$row["s_filenameprefix"].'.xml">;
?>