<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.text { font-family: Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; font-weight: normal; color: #000000}
.list { font-family: Arial, Helvetica, sans-serif; font-size: small; font-style: normal; font-weight: bold; color: #0000FF}
.list a:link { font-family: Arial, Helvetica, sans-serif; text-decoration: none; color: #0000FF}
.list a:visited { font-family: Arial, Helvetica, sans-serif; text-decoration: none; color: #0000FF}
.list a:hover { font-family: Arial, Helvetica, sans-serif; text-decoration: underline; color: #0000FF}
.text a:link { font-family: Arial, Helvetica, sans-serif; text-decoration: none; color: #000000}
.text a:visited { font-family: Arial, Helvetica, sans-serif; text-decoration: none; color: #000000}
.text a:hover { font-family: Arial, Helvetica, sans-serif; text-decoration: underline; color: #000000}
table { background-color: #CCCCCC; border: 1px #000000 solid}
td { background-color: #FFFFFF; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
-->
</style>
</head>
<body>
<?
$db=mysql_connect("deinhost","deinuser","deinpasswort");
mysql_select_db("video",$db);
if (($uid)&&($pwd))
{
$users=mysql_query("select * from users where id='$uid'",$db);
$user=mysql_fetch_array($users);
if ($user[2]==$pwd)
{
if ($edit)
{
$filme=mysql_query("select * from filme where id='$edit'",$db);
$film=mysql_fetch_array($filme);
printf("<form method='post' action='$PHP_SELF'>");
printf("<input type='hidden' name='uid' value='%s'>",$uid);
printf("<input type='hidden' name='pwd' value='%s'>",$pwd);
printf("<input type='hidden' name='id' value='%s'>",$edit);
printf("Titel: <input type='text' name='titel' value='%s'><br>",$film[1]);
printf("Kategorie: ");
printf("<select name='kategorie'>");
$kategorien=mysql_query("select * from kategorien order by kategorie",$db);
while ($kategorie=mysql_fetch_row($kategorien))
{
printf("<option value='%s' ",$kategorie[0]);
if ($kategorie[0]==$film[2])
{
printf("selected ");
}
printf(">%s",$kategorie[1]);
}
printf("</select><br>");
printf("Sprache: ");
printf("<select name='sprache'>");
$sprachen=mysql_query("select * from sprachen order by sprache",$db);
while ($sprache=mysql_fetch_row($sprachen))
{
printf("<option value='%s' ",$sprache[0]);
if ($sprache[0]==$film[4])
{
printf("selected ");
}
printf(">%s",$sprache[1]);
}
printf("</select><br>");
printf("Format: ");
printf("<select name='format'>");
$formate=mysql_query("select * from formate order by format",$db);
while ($format=mysql_fetch_row($formate))
{
printf("<option value='%s' ",$format[0]);
if ($format[0]==$film[3])
{
printf("selected ");
}
printf(">%s",$format[1]);
}
printf("</select><br>");
printf("Anzahl CDs: <input type='text' name='cds' value='%s'><br>",$film[5]);
printf("<input type='submit' name='update' value='Ändern'>");
printf("</form>");
}
else
{
if ($insert)
{
mysql_query("insert into filme (titel,kategorieid,formatid,sprachid,cds,userid) values ('$titel','$kategorie','$format','$sprache','$cds','$uid')",$db);
}
if ($delete)
{
mysql_query("delete from filme where id='$delete'",$db);
}
if ($update)
{
mysql_query("update filme set titel='$titel',kategorieid='$kategorie',formatid='$format',sprachid='$sprache',cds='$cds' where id='$id'",$db);
}
printf("<table border='1' align='center'>");
printf("<tr><td align='center' class='list'>Titel</td><td align='center' class='list'>Kategorie</td><td align='center' class='list'>Sprache</td><td align='center' class='list'>Format</td><td align='center' class='list'>CDs</td><td align='center' colspan='2' class='list'>Aktion</td></tr>");
$filme=mysql_query("select * from filme where userid='$uid' order by titel",$db);
while ($film=mysql_fetch_row($filme))
{
$kategorien=mysql_query("select * from kategorien where id='$film[2]'",$db);
$kategorie=mysql_fetch_array($kategorien);
$formate=mysql_query("select * from formate where id='$film[3]'",$db);
$format=mysql_fetch_array($formate);
$sprachen=mysql_query("select * from sprachen where id='$film[4]'",$db);
$sprache=mysql_fetch_array($sprachen);
$users=mysql_query("select * from users where id='$film[6]'",$db);
$user=mysql_fetch_array($users);
printf("<tr><td class='text'>%s</td><td align='center' class='text'>%s</td><td align='center' class='text'>%s</td><td align='center' class='text'>%s</td><td align='center' class='text'>%s</td><td class='text'><a href='$PHP_SELF?uid=%s&pwd=%s&delete=%s'>Löschen</a></td><td class='text'><a href='$PHP_SELF?uid=%s&pwd=%s&edit=%s'>Bearbeiten</a></td></tr>",$film[1],$kategorie[1],$sprache[1],$format[1],$film[5],$uid,$pwd,$film[0],$uid,$pwd,$film[0]);
}
printf("</table>");
printf("<form method='post' action='$PHP_SELF'>");
printf("<input type='hidden' name='uid' value='%s'>",$uid);
printf("<input type='hidden' name='pwd' value='%s'>",$pwd);
printf("Titel: <input type='text' name='titel'><br>");
printf("Kategorie: ");
printf("<select name='kategorie'>");
$kategorien=mysql_query("select * from kategorien order by kategorie",$db);
while ($kategorie=mysql_fetch_row($kategorien))
{
printf("<option value='%s'>%s",$kategorie[0],$kategorie[1]);
}
printf("</select><br>");
printf("Sprache: ");
printf("<select name='sprache'>");
$sprachen=mysql_query("select * from sprachen order by sprache",$db);
while ($sprache=mysql_fetch_row($sprachen))
{
printf("<option value='%s'>%s",$sprache[0],$sprache[1]);
}
printf("</select><br>");
printf("Format: ");
printf("<select name='format'>");
$formate=mysql_query("select * from formate order by format",$db);
while ($format=mysql_fetch_row($formate))
{
printf("<option value='%s'>%s",$format[0],$format[1]);
}
printf("</select><br>");
printf("Anzahl CDs: <input type='text' name='cds'><br>");
printf("<input type='submit' name='insert' value='Einfügen'>");
printf("</form>");
}
}
else
{
printf("Es ist ein Fehler aufgetreten.");
}
}
else
{
printf("<table align='center'>");
printf("<tr><td class='list' align='center'><a href='$PHP_SELF?sort=titel'>Titel</a></td><td class='list' align='center'><a href='$PHP_SELF?sort=kategorieid'>Kategorie</a></td></td><td class='list' align='center'> </td></tr>");
$filme=mysql_query("select * from filme order by '$sort',titel",$db);
while ($film=mysql_fetch_row($filme))
{
$kategorien=mysql_query("select * from kategorien where id='$film[2]'",$db);
$kategorie=mysql_fetch_array($kategorien);
$formate=mysql_query("select * from formate where id='$film[3]'",$db);
$format=mysql_fetch_array($formate);
$sprachen=mysql_query("select * from sprachen where id='$film[4]'",$db);
$sprache=mysql_fetch_array($sprachen);
$users=mysql_query("select * from users where id='$film[6]'",$db);
$user=mysql_fetch_array($users);
if ($film[1]!=$vorigerfilm)
{
printf("<tr><td class='text'>%s</td><td align='center' class='text'>%s</td><td class='text'><a href='order.php?filmid=%s'>Order</a></td></tr>",$film[1],$kategorie[1],$film[0]);
$vorigerfilm=$film[1];
}
}
printf("</table>");
}
$db=mysql_close($db);
?>
</body>
</html>