Hey,
Ik heb een nieuws reactie script maar ik wil dat als je een nieuwe reactie post dat je wordt doorgestuurd naar die reactie. Maar mijn param 2 wilt het niet doen.
Weet iemand hoe ik dit oplos?
PHP
<?php
include 'includes/config.php';
if(isset($param[1]))
{
$nieuwsQuery = $core->mysql->query("SELECT
id,
titel,
inhoud,
schrijver_id,
datum
FROM
nieuws_nieuwsberichten
WHERE
id = '".$param[1]."'");
$nieuwsFetch = $core->mysql->fetch($nieuwsQuery);
$aantalcommentsQuery = $core->mysql->query("SELECT
1
FROM
nieuws_reacties
WHERE
nieuwsbericht_id = '".$param[1]."'");
$totaal = $core->mysql->num_rows($aantalcommentsQuery);
$huidige = (isset($param[2]) && ctype_digit($param[2]) && $param[2] > 0) ? $param[2] : 1;
$per_pagina = 10;
$str = paging('nieuws/'.$param[1].'/', $totaal, $per_pagina, $huidige);
$reactiesQuery = $core->mysql->query("SELECT
n.id,
n.lid_id,
n.inhoud,
n.datum,
l.uLeerjaar,
l.uAvatar,
l.uName,
l.uRang,
l.uAfdeling
FROM
nieuws_reacties n,
leden_leden l
WHERE
n.nieuwsbericht_id = '".$nieuwsFetch['id']."'
AND
n.lid_id = l.uId
ORDER BY
n.id
LIMIT
".(($huidige * $per_pagina) - $per_pagina).", ".$per_pagina);
define('_TITLE_', $nieuwsFetch['titel']);
include 'includes/header.php';
if($core->mysql->num_rows($nieuwsQuery) == 1)
{
echo '<div class="nieuws-titel">› <strong>'.$nieuwsFetch['titel'].'</strong></div>
<div class="nieuws-container">'.parseUbb($nieuwsFetch['inhoud']).'</div>
<div class="nieuws-bottom" style="margin-bottom: 20px;">Gepost op '.$nieuwsFetch['datum'].' door '.$core->leden->naam($nieuwsFetch['schrijver_id']).'</div>';
if($core->mysql->num_rows($reactiesQuery) >= 1)
{
while($reactiesFetch = $core->mysql->fetch($reactiesQuery))
{
?>
<div class="nieuws-titel">› <strong>Gepost op <?php echo $reactiesFetch['datum']; ?></strong></div>
<div class="reactie-container" id="post_<?php echo $reactiesFetch['id']; ?>">
<div class="nieuws-inhoud">
<div class="nieuws-ledeninfo">
<a href="<?php echo _ROOT_; ?>profiel/<?php echo $core->leden->naam($reactiesFetch['lid_id']); ?>" style="text-decoration: none;"><span style="color: #<?php echo $reactiesFetch['uColor']; ?>; font-weight: bold"><?php echo $core->leden->naam($reactiesFetch['lid_id']); ?></span></a><br />
<small><?php echo $functies[$reactiesFetch['uRang']]; ?></small><br /><br />
<img src="<?php echo _ROOT_; ?><?php echo $reactiesFetch['uAvatar']; ?>" alt="Avatar" /><br /><br />
<?php echo $reactiesFetch['uLeerjaar']; ?><sup>e</sup> <?php echo $afdelingen[$reactiesFetch['uAfdeling']]; ?>
</div>
<div class="nieuws-bericht">
<?php echo parseUbb($reactiesFetch['inhoud']); ?>
</div>
<div style="clear: both;"></div>
</div>
</div>
<?php
}
echo ''.$str.'';
}
else
{
echo '<strong>Er zijn geen reacties in dit nieuwsbericht.</strong>';
}
}
else
{
header('Location: '._ROOT_.'');
}
if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['submit'])
{
if(trim($_POST['bericht']) == '')
{
$core->fouten->add('Je bent een bericht vergeten in te vullen.');
}
if($core->fouten->aantal() == 0)
{
$core->mysql->query("INSERT INTO
nieuws_reacties
(
lid_id,
datum,
inhoud,
nieuwsbericht_id
) VALUES (
'".$core->leden->info['mijn']['uId']."',
NOW(),
'".$core->mysql->escape($_POST['bericht'])."',
'".$core->mysql->escape($param[1])."'
)");
$postid = $core->mysql->insert_id();
header('Location: '._ROOT_.'nieuws/'.$param[1].'/'.$param[2].'#'.$postid.'');
}
else
echo '<br />'.$core->fouten->weergeef();
}
?>
<div class="nieuws-titel" style="margin-top: 10px;">› <strong>Reageer</strong></div>
<div class="nieuws-inhoud">
<form action="" method="post">
<textarea style="height: 100px; width: 300px;" name="bericht" id="bericht" tabindex="2"></textarea><br /><br />
<input type="submit" name="submit" value="Verzend" />
</form>
</div>
<?php
}
include 'includes/footer.php';
?>
Toon Meer