
<?php
require "include/bittorrent.php";
dbconn();


    function Moderator($day,$time)
    {
     $sql     = "SELECT * FROM sendeplan WHERE day = '$day' AND time = '$time'";
     $result2 = mysql_query($sql) OR die(mysql_error());
     $mod     = mysql_fetch_assoc($result2);
     if($mod['time'] == $time){echo "<b><center><span href=\"sendshow.php\"onMouseOver=\"overlib(' <span <b><font color=red>Genre:</font></b><br><font size=2>".stripslashes($mod['genre'])."</font></span> ');\" onMouseOut=\"nd();\">".stripslashes($mod['mod'])."</span></center></b>";}else{echo "<center>-</center>";}
    }


    function Moderator2($day,$time)
    {
     $sql     = "SELECT * FROM sendeplan WHERE day = '$day' AND time = '$time'";
     $result2 = mysql_query($sql) OR die(mysql_error());
     $mod     = mysql_fetch_assoc($result2);
         if($mod['time'] == $time){
    echo "    <center>
        Genre:<br></font><b><font color=red><font size=2>".stripslashes($mod['genre'])."</font></font></b>
        <br>    
        Mod:<br></font><b><font size=2><font color=Blue>".stripslashes($mod['mod'])."</font></b>
        </center>";
    }
    else
    {
    echo "<center>-</center>";
    }
    }
stdhead("Sendeplan");

begin_frame("<center><img src='pic/radiolisten.png' width='22' height='22' alt='' style='vertical-align: middle;'> <b> BitPirates Stream</b></center>");

if (get_user_class() >= UC_MODERATOR) {
//   echo $_POST['submit'] ."-".$_POST['day']."-".$_POST['time']."-".$_POST['mod']."-".$_POST['genre'];
   echo "        <table align='center' cellpadding='4' cellspacing='1' border='0' width='400' class='tableinborder'>
                 <tr><td class='tabletitle' colspan='10' width='100%'><span class='normalfont'><center><b>Sendeplan bearbeiten</b></td></tr>
                 <td class='tablea' width='100' valign='top'>
        <a href=sendshow.php><input type=submit class=btn value=Editieren></a>
                 <br><br>
        <a href=senddel.php><input type=submit class=btn value=Plan-Löschen></a>
                 <br><br>
                 <td class='tablea' width='300' valign='top'>";
if(isset($_POST['submit']) && "ja" == $_POST['submit'])
  {
   $sql = "DELETE FROM sendeplan";
   mysql_query($sql) OR die(mysql_error());
   echo "<br><font color='red'><b>Sendeplan erfolgreich geleert.</b></font>";
  }
   else
  {
   echo "<form action='senddel.php' method='post'>
         <br><font color='red'><b>Sendeplan wirklich komplett leeren ???</b></font>
         <br><br><input type='submit' name='submit' value='ja'></input></form>";
  }
    echo "    </td></tr></table><br>";
     }

echo "

<html>
<body>

   <table align='center' width='96%' cellpadding='3' cellspacing='0' border='1'>
    <tr>
     <td width='9%' class='tabletitle'> <span class='normalfont'><center><b>&nbsp;Zeit</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Samstag</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Sonntag</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Montag</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Dienstag</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Mittwoch</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Donnerstag</b></span></td>
     <td width='13%' class='tabletitle'> <span class='normalfont'><center><b>Freitag</b></span></td>
    </tr>";

$time    = "0";
 while($time < 24)
 {
 $sql    = "SELECT * FROM sendeplan";
 $result = mysql_query($sql) OR die(mysql_error());
 $row    = mysql_fetch_assoc($result);

 echo "

    <tr>
     <td width='9%'  class='tablecat'> <b><center>&nbsp;";if($time < 10){echo "0$time";}else{echo "$time";}echo "</b>:00</td>
     <td width='13%' class='tablea'>";Moderator(Samstag,$time).$row['genre']; echo "</td>
     <td width='13%' class='tablea'>";Moderator(Sonntag,$time); echo "</td>
     <td width='13%' class='tablea'>";Moderator(Montag,$time); echo "</td>
     <td width='13%' class='tablea'>";Moderator(Dienstag,$time); echo "</td>
     <td width='13%' class='tablea'>";Moderator(Mittwoch,$time); echo "</td>
     <td width='13%' class='tablea'>";Moderator(Donnerstag,$time); echo "</td>
     <td width='13%' class='tablea'>";Moderator(Freitag,$time); echo "</td>
    </tr>"; $time++;
 }



echo "

  </td>
 </tr>
</table>";


end_frame();
stdfoot();
?>