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
|
<?php require("configure.php"); ?>
<?php $header = "<?xml version='1.0' encoding='utf-8'?>\n<playlist version='1' xmlns='http://xspf.org/ns/0/'>"; $nodeStart = "<trackList>\n"; $nodeEnd = "</trackList>\n</playlist>\n";
?> <?php function write_beg($filename, $header, $nodeStart, $data, $nodeEnd) { //Imports old data $handle = fopen($filename, "r"); $old_content = fread($handle, filesize ($filename));
$f[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; $f[] = "<content>"; $f[] = "</content>";
foreach($f as $key => $value) { $old_content = trim(str_replace($value, "", $old_content)); }
fclose($handle);
//Sets up new data $final_content = $header.$nodeStart.$data.$old_content.$nodeEnd;
//Writes new data $handle2 = fopen($filename, "w"); $finalwrite = fwrite($handle2, $final_content); fclose($handle2); } ?>
<?php $filename = "../slideshow/index.xml"; // File which holds all data
unlink($filename);
$sql = "select * from slide2 order by slide2id DESC"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $data .= "<track>\n<title>". $row{'slide2title'} ." </title>\n<creator>rainbow mission</creator>\n<location>../webadmin/slide2/". $row{'slide2image'} ."</location>\n<info> </info>\n</track>\n"; }
write_beg($filename, $header, $nodeStart, $data, $nodeEnd); ?>
|