<?php
$action = $_GET['a'];
if($action == "eintragen")
{
$time = time();
$von1 = $_POST["von1"];
$von2 = $_POST["von2"];
$bis1 = $_POST["bis1"];
$bis2 = $_POST["bis2"];
$tag = $_POST["tag"];
$monat = $_POST["monat"];
$jahr = $_POST["jahr"];
$mod = $_POST["mod"];
$modpic = $_POST["modpic"];
$show = $_POST["show"];
$showpic = $_POST["showpic"];
$beginn = mktime($von1,$von2,0,$monat,$tag,$jahr);
$ende = mktime($bis1,$bis2,0,$monat,$tag,$jahr);
$a = 0;
if($beginn >= $time)
{
if($beginn <= $ende)
{
$a = 1;
}
}
if($a == 0)
{
echo "<table align=\"center\" width=\"100%\"><tr><td>";
echo "Deine Sendezeit liegt vor der Aktuellen Zeit.<br> In der Vergangenheit senden geht bissel schlecht ;-)";
echo "</td></tr></table>";
echo "<meta http-equiv=\"refresh\" content=\"7; url=indexdj.php?site=eintragen\">";
}
if($a == 1)
{
$sql = "SELECT id FROM sendeplan WHERE {$beginn} < ende AND {$ende} > beginn";
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0) {
$sql = "INSERT INTO `sendeplan` (`beginn`,`ende`,`d`,`m`,`y`,`show`,`showpic`,`name`,`pic`) VALUES ('$beginn','$ende','$tag','$monat','$jahr','$show','$showpic','$mod','$modpic');";
mysql_query($sql);
echo "Sendung mit der ID ". mysql_insert_id() ."hinzugefügt";
} else {
echo "Sendezeit schon belegt";
}
mysql_free_result($result);
}
}
?>
<form id="form1" name="form1" method="post" action="?site=sende_eintragen&a=eintragen">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30">DeeJay / Moderator:</td>
<td><label>
<select name="mod" id="mod">
<?php
$sql_dj="SELECT * FROM sendeplan_mod";
$request_mod=mysql_query($sql_dj);
while($row=mysql_fetch_object($request_mod))
{
?>
<option value="<? echo $row->name; ?>"><? echo $row->name; ?></option>
<?
}
?>
</select>
</label></td>
</tr>
<tr>
<td height="30">DeeJay / Moderator Bild:</td>
<td><select name="modpic" id="modpic">
<?php
$sql_dj="SELECT * FROM sendeplan_mod";
$request_mod=mysql_query($sql_dj);
while($row=mysql_fetch_object($request_mod))
{
?>
<option value="<? echo $row->pic; ?>"><? echo $row->pic; ?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td height="30">Show:</td>
<td><select name="show" id="show">
<?php
$sql_show="SELECT * FROM sendeplan_show";
$request_show=mysql_query($sql_show);
while($row=mysql_fetch_object($request_show))
{
?>
<option value="<? echo $row->showname; ?>"><? echo $row->showname; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td height="30">Show Bild:</td>
<td><select name="showpic" id="showpic">
<?php
$sql_show="SELECT * FROM sendeplan_show";
$request_show=mysql_query($sql_show);
while($row=mysql_fetch_object($request_show))
{
?>
<option value="<? echo $row->bild; ?>"><? echo $row->bild; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td height="30">Tag:</td>
<td>Tag:
<input name="tag" type="text" id="tag" size="6" />
Monat:
<input name="monat" type="text" id="monat" size="6" />
Jahr:
<input name="jahr" type="text" id="jahr" size="6" /></td>
</tr>
<tr>
<td height="30">Von:</td>
<td><select name="von1" id="von1">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
</select>
-
<select name="von2" id="von2">
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
</select></td>
</tr>
<tr>
<td height="30">Bis:</td>
<td><select name="bis1" id="bis1">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
</select>
-
<select name="bis2" id="bis2">
<option value="0">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
</select></td>
</tr>
<tr>
<td height="30"> </td>
<td> </td>
</tr>
<tr>
<td height="30"> </td>
<td><input type="submit" name="button" id="button" value="Eintragen" /></td>
</tr>
</table>
</form>