Tilføj til MySQL
<?php include("top.php");if (!isset($mnd)) {
$mnd = date(n);
$aar = date(Y);
if($form) {
$sql = "INSERT INTO `kalender` (`id`, `dato`, `mnd`, `aar`, `txt`, `navn`, `pris`, `deltagere`, `url`, ) VALUES ('', '$form_dato', '$form_mnd', '$form_aar', '$form_txt', '$form_navn', '$form_pris', '$form_deltager', '$form_url')";
$result = mysql_query($sql);
$sql = "INSERT INTO `log` (`id`, `dato`, `ip`, `short`, `type`, `farve`) VALUES ('', '$dato', '$ip', 'Event tilføjet', '$usrnavn har tilføjet et event', 'black')";
$result = mysql_query($sql);
}
}
?>
<center>
<fieldset>
<legend>Kalender</legend>
</center>
<br>
<?php
$maaned = array(" ", "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December");
?>
<b><font class="dato"><? print $maaned[$mnd] . " " . $aar; ?></b></font><br><br>
<?
$query = mysql_query("SELECT COUNT(*) AS countd FROM kalender WHERE mnd = '$mnd' AND aar = '$aar'") or die(mysql_error());
$RS = mysql_fetch_array($query);
if($RS['countd']=="0"){
print " Ingen Event idag :( men prøv en af de andre dage...";
} else {
$hentdato = mysql_query("SELECT * FROM kalender WHERE mnd = '$mnd' AND aar = '$aar'");
while ($dato = mysql_fetch_array($hentdato)) {
print "<p class='margin'>";
if ($_SESSION[usr]) {
?><a href="user.php?action=sletevent&id=<?php print $dato['id'];
?>" onclick="return confirm('Sikker på de vil slette eventet?');" ><img src="pics/logo/slet.gif" border="0"></a>
<a href="user.php?action=redigerevent&id=<?php print $dato['id'];
?>"><img src="pics/logo/red.gif" border="0"></a>
<?php
}
?>
<a href="java script:PopWin('info.php?type=event&id=<?php print $dato['id'];?>', 350, 600)">
<?
print "Den ". $dato['dato'] . " " . $maaned[$mnd] . " " . $dato['aar'];
print "</p><p class='margin2'>";
print "<font class='kursiv2'>";
print $dato['txt'];
print "</font>";
print "</p>";
print "</a>";
}
}
print "<br><br>";
?>
<form action="<?=$PHP_SELF;?>" method="get">
<select name="mnd" id="t6" />
<option value="1" <? if($mnd=='1'){ print "selected='selected'"; } ?>>Januar</option>
<option value="2" <? if($mnd=='2'){ print "selected='selected'"; } ?>>Februar</option>
<option value="3" <? if($mnd=='3'){ print "selected='selected'"; } ?>>Marts</option>
<option value="4" <? if($mnd=='4'){ print "selected='selected'"; } ?>>April</option>
<option value="5" <? if($mnd=='5'){ print "selected='selected'"; } ?>>Maj</option>
<option value="6" <? if($mnd=='6'){ print "selected='selected'"; } ?>>Juni</option>
<option value="7" <? if($mnd=='7'){ print "selected='selected'"; } ?>>Juli</option>
<option value="8" <? if($mnd=='8'){ print "selected='selected'"; } ?>>August</option>
<option value="9" <? if($mnd=='9'){ print "selected='selected'"; } ?>>September</option>
<option value="10" <? if($mnd=='10'){ print "selected='selected'"; } ?>>Oktober</option>
<option value="11" <? if($mnd=='11'){ print "selected='selected'"; } ?>>November</option>
<option value="12" <? if($mnd=='12'){ print "selected='selected'"; } ?>>December</option>
</select>
<input name="aar" type="text" value="<? print $aar; ?>" maxlength="4" id="t9" />
<input type="submit" value="Gå til" id="dato" />
</form>
<?
if ($_SESSION['usr']) {
print "<hr size='1' color='#4878BD'>"; ?>
<form action="<?=$PHP_SELF;?>" method="post">
<label for="t8">Navn: </label> <input name="form_navn" type="text" id="t4" />
<label for="t8">Pris: </label> <input name="form_pris" type="text" id="t4" />
<label for="t8">Deltagere: </label> <input name="form_deltager" type="text" id="t4" />
<label for="t8">URL: </label> <input name="form_url" type="text" id="t4" />
<label for="t8">Dato: </label> <input name="form_dato" type="text" value="<? print date(j); ?>" maxlength="2" id="t8" />
<select name="form_mnd" id="t6" />
<option value="1" <? if($mnd=='1'){ print "selected='selected'"; } ?>>Januar</option>
<option value="2" <? if($mnd=='2'){ print "selected='selected'"; } ?>>Februar</option>
<option value="3" <? if($mnd=='3'){ print "selected='selected'"; } ?>>Marts</option>
<option value="4" <? if($mnd=='4'){ print "selected='selected'"; } ?>>April</option>
<option value="5" <? if($mnd=='5'){ print "selected='selected'"; } ?>>Maj</option>
<option value="6" <? if($mnd=='6'){ print "selected='selected'"; } ?>>Juni</option>
<option value="7" <? if($mnd=='7'){ print "selected='selected'"; } ?>>Juli</option>
<option value="8" <? if($mnd=='8'){ print "selected='selected'"; } ?>>August</option>
<option value="9" <? if($mnd=='9'){ print "selected='selected'"; } ?>>September</option>
<option value="10" <? if($mnd=='10'){ print "selected='selected'"; } ?>>Oktober</option>
<option value="11" <? if($mnd=='11'){ print "selected='selected'"; } ?>>November</option>
<option value="12" <? if($mnd=='12'){ print "selected='selected'"; } ?>>December</option>
</select>
<input name="form_aar" type="text" value="<? print $aar; ?>" maxlength="4" id="t9" />
<label for="t5">Tekst:</label><textarea name="form_txt" id="t5" rows="2" cols="20"></textarea><br />
<input type="hidden" name="form" value="form">
<p class="form"><input type="submit" value="Tilføj event" id="submit" /><input type="reset" value="Slet alt" id="submit" /></p>
</form>
<?php
}
?>
</fieldset>
<?php include("bund.php");
?>
^den tilføjer ikke noget, siger ingen fejl eller noget..