-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_tutorial_xml.php
44 lines (37 loc) · 1.33 KB
/
edit_tutorial_xml.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
<?php
include("login_functions.php");
if(loggedin()){
header("Content-type:text/xml;charset=utf-8");
echo '<?xml version="1.0"?>';
echo '<?xml-stylesheet type="text/xsl" href="edit_tutorial.xsl"?>';
echo "<tutorial>";
include("connect.php");
$XMLcontent = "";
$tutorialID = $_GET['id'];
$query = "SELECT * FROM tutorial WHERE Id=$tutorialID";
$result = mysql_query($query) or die("Query failed.");
while ($row = mysql_fetch_object($result)){
$url = $row->YouTube_URL;
$id = $row->Id;
$date = $row->Date;
$title = $row->Title;
$artist = $row->Artist;
$tuning = $row->Tuning;
$genre = $row->Genre;
$spotify = $row->Spotify_URL;
$user = $row->Username;
$XMLcontent = $XMLcontent . "<id>$id</id>";
$XMLcontent = $XMLcontent . "<username>$user</username>";
$XMLcontent = $XMLcontent . "<youtube>$url</youtube>";
$XMLcontent = $XMLcontent . "<title><![CDATA[$title]]></title>";
$XMLcontent = $XMLcontent . "<artist><![CDATA[$artist]]></artist>";
$XMLcontent = $XMLcontent . "<date>$date</date>";
$XMLcontent = $XMLcontent . "<genre>$genre</genre>";
$XMLcontent = $XMLcontent . "<spotify>$spotify</spotify>";
$XMLcontent = $XMLcontent . "<tuning>$tuning</tuning>";
}
echo utf8_encode($XMLcontent);
echo "</tutorial>";
}
else header("Location: index.php");
?>