Hee ik krijg het niet voor elkaar met die Cron ik weet niet hoe ik het neer moet zetten.
Cron:
PHP
$secs = rand(3600,86400);
if(floor($update['actie']/$secs) != floor(time()/$secs)) {
$dbres = mysql_query("SELECT GET_LOCK('half_update',0)");
if(mysql_result($dbres,0) == 1) {
$cron_pass = "secretcronpassword";
mysql_query("UPDATE `[cron]` SET `time`=NOW() WHERE `name`='actie'");
include("_cron_actie.php");
mysql_query("SELECT RELEASE_LOCK('actie_update')");
}
}
Dit is script:
PHP
<?php
if(isset($_GET['p'])) {
$hidden = "name=\"p\"";
}
echo'
<div id="content_top"> </div>
<div id="content">
<h1 class="titel">Laatste nieuws</h1>
';
$nieuwtje = mysql_fetch_query("SELECT id, datum, titel, auteur, bericht, cid FROM forum_topic WHERE cid = '1' ORDER BY datum DESC");
$auteur = mysql_fetch_query("SELECT login FROM users WHERE id = '" . $nieuwtje['auteur'] . "'");
$bericht = $nieuwtje['bericht'];
$bericht = htmlspecialchars(stripslashes($bericht));
$filter = new filter();
$bericht = $filter->scheldwoorden($bericht);
$bericht = $filter->ubb($bericht);
$bericht = $filter->smilies($bericht);
echo'
<div class="warningbar"><span class="dark">' . date("d-m-Y", $nieuwtje['datum']) . ':</span> <a href="index.php?p=forum&cat=' . $nieuwtje['cid'] . '&topic=' . $nieuwtje['id'] . '">' . stripslashes($nieuwtje['titel']) . '</a> <span class="dark">Door:</span> <a href="index.php?p=profile&uid=' . $nieuwtje['auteur'] . '">' . $auteur['login'] . '</a>.</div>
<div class="dark">' . stripslashes(nl2br($bericht)) . '</div>
</div>
<div id="content_bottom"> </div>
<div id="content_top"> </div>
<div id="content">
<h1 class="titel">Index</h1>
';
if($own['safe'] > 0) {
echo"<div class=\"dark\" style=\"padding-bottom: 5px;\">Je staat nog " . $own['safe'] . " uur onder bescherming.<br />
</div>
<br />";
}
echo'
<b>Actieve forum topics</b><br /><br />
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="start">Titel</td>
<td class="start"> </td>
<td class="start">Laatste reactie</td>
<td class="start">Datum</td>
<td class="start">Reacties</td>
</tr>';
$cidbl = ($own['beheerder'] != "Ja" && $own['admin'] != "Ja" && $own['moderator'] != "Ja") ? (" WHERE cid != '6' ") : (" ");
$query = mysql_query("SELECT * FROM forum_topic{$cidbl}ORDER BY reactie DESC LIMIT 5");
while($topic = mysql_fetch_assoc($query)) {
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM forum_post WHERE datum = '" . $topic['reactie'] . "' AND tid = '" . $topic['id'] . "'"));
if(empty($post['auteur'])) {
$auteur = mysql_fetch_assoc(mysql_query("SELECT id, login FROM users WHERE id = '" . $topic['auteur'] . "' LIMIT 1"));
$post['datum'] = $topic['datum'];
}
else {
$auteur = mysql_fetch_assoc(mysql_query("SELECT id, login FROM users WHERE id = '" . $post['auteur'] . "' LIMIT 1"));
}
$reacties = mysql_num_rows(mysql_query("SELECT id FROM forum_post WHERE tid = '" . $topic['id'] . "'"));
if (strlen($topic['titel']) > 25) { $topic['titel'] = substr($topic['titel'], 0, 25); $topic['titel'] = $topic['titel'] . "..."; }
echo'<tr>
<td class="list"><a href="index.php?p=forum&cat=' . $topic['cid'] . '&topic=' . $topic['id'] . '">' . stripslashes($topic['titel']) . '</a></td>
<td class="list">' . online($auteur['id']) . '</td>
<td class="list"><a href="index.php?p=profile&uid=' . $auteur['id'] . '">' . special_check($auteur['id']) . '</a></td>
<td class="list">' . date("d-m-Y / H:i", $post['datum']) . '</td>
<td class="list">' . $reacties . '</td>
</tr>';
}
echo'
</table><br /><br />
</div>
<div id="content_bottom"> </div>';
include("outgame/top5.php");
?>
Toon Meer
En dat wil ik vervangen door dit script:
PHP
<?php
if(isset($_GET['p'])) {
$hidden = "name=\"p\"";
}
echo"<div class=\"dark\"><font color=\"green\" style=\"font-weight: bold\"></font></div><br />";
echo'
<div id="content_top"> </div>
<div id="content">
<h1 class="titel">Laatste nieuws</h1>
';
$nieuwtje = mysql_fetch_query("SELECT id, datum, titel, auteur, bericht, cid FROM forum_topic WHERE cid = '1' ORDER BY datum DESC");
$auteur = mysql_fetch_query("SELECT login FROM users WHERE id = '" . $nieuwtje['auteur'] . "'");
$bericht = $nieuwtje['bericht'];
$bericht = htmlspecialchars(stripslashes($bericht));
$filter = new filter();
$bericht = $filter->scheldwoorden($bericht);
$bericht = $filter->ubb($bericht);
$bericht = $filter->smilies($bericht);
echo'
<div class="warningbar"><span class="dark">' . date("d-m-Y", $nieuwtje['datum']) . ':</span> <a href="index.php?p=forum&cat=' . $nieuwtje['cid'] . '&topic=' . $nieuwtje['id'] . '">' . stripslashes($nieuwtje['titel']) . '</a> <span class="dark">Door:</span> <a href="index.php?p=profile&uid=' . $nieuwtje['auteur'] . '">' . $auteur['login'] . '</a>.</div>
<div class="dark">' . stripslashes(nl2br($bericht)) . '</div>
</div>
<div id="content_bottom"> </div>
<div id="content_top"> </div>
<div id="content">
<h1 class="titel">Index</h1>
';
if($own['safe'] > 0) {
echo"<div class=\"dark\" style=\"padding-bottom: 5px;\">Je staat nog " . $own['safe'] . " uur onder bescherming.<br />
</div>
<br />";
}
echo'
<b>Actieve forum topics</b><br /><br />
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="start">Titel</td>
<td class="start"> </td>
<td class="start">Laatste reactie</td>
<td class="start">Datum</td>
<td class="start">Reacties</td>
</tr>';
$cidbl = ($own['beheerder'] != "Ja" && $own['admin'] != "Ja" && $own['moderator'] != "Ja") ? (" WHERE cid != '6' ") : (" ");
$query = mysql_query("SELECT * FROM forum_topic{$cidbl}ORDER BY reactie DESC LIMIT 5");
while($topic = mysql_fetch_assoc($query)) {
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM forum_post WHERE datum = '" . $topic['reactie'] . "' AND tid = '" . $topic['id'] . "'"));
if(empty($post['auteur'])) {
$auteur = mysql_fetch_assoc(mysql_query("SELECT id, login FROM users WHERE id = '" . $topic['auteur'] . "' LIMIT 1"));
$post['datum'] = $topic['datum'];
}
else {
$auteur = mysql_fetch_assoc(mysql_query("SELECT id, login FROM users WHERE id = '" . $post['auteur'] . "' LIMIT 1"));
}
$reacties = mysql_num_rows(mysql_query("SELECT id FROM forum_post WHERE tid = '" . $topic['id'] . "'"));
if (strlen($topic['titel']) > 25) { $topic['titel'] = substr($topic['titel'], 0, 25); $topic['titel'] = $topic['titel'] . "..."; }
echo'<tr>
<td class="list"><a href="index.php?p=forum&cat=' . $topic['cid'] . '&topic=' . $topic['id'] . '">' . stripslashes($topic['titel']) . '</a></td>
<td class="list">' . online($auteur['id']) . '</td>
<td class="list"><a href="index.php?p=profile&uid=' . $auteur['id'] . '">' . special_check($auteur['id']) . '</a></td>
<td class="list">' . date("d-m-Y / H:i", $post['datum']) . '</td>
<td class="list">' . $reacties . '</td>
</tr>';
}
echo'
</table><br /><br />
</div>
<div id="content_bottom"> </div>';
include("outgame/top5.php");
?>
Toon Meer
Waar zet ik die Cron dan?
Bever