hallo Criminalspoint,
De laatste tijd ben ik bezig met een forum die op de webfanaat source is gebaseerd.
Hier is de core van het forum:
PHP
<?php
if($_GET['actie'] == ""){
echo <<<ENDHTML
<div class="news">
<div class="cBoxHeader"><h2><b>Forum</b></h2></div>
<div class="cBoxBg">
<div class="cBoxText">
ENDHTML;
echo "<span class='bold'>Forum > Index</span><br />";
echo "Welcom on our forum.<br>";
$select = mysql_query("SELECT * FROM forum_cats")or die(mysql_error());
While($list = mysql_fetch_array($select)){
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0' style='border-top: 1px solid #eeeeee;'>";
echo "<tr>";
echo "<td width='100%'>» ".$list['naam']."</td>";
echo "</tr>";
echo "</table>";
$select1 = mysql_query("SELECT * FROM forum_sub_cats WHERE catid='".$list['id']."'")or die(mysql_error());
WHILE($show = mysql_fetch_array($select1)){
if($beveilig->crew == 1 && functie() < 2){
$selonderdeel = "";
}
else{
$selonderdeel = "AND crew != '1'";
}
}
$select2 = mysql_query("SELECT * FROM forum_sub_cats WHERE catid = '".$list['id']."' ".$sql2)or die(mysql_error());
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0' style='border-top: 1px solid #e1e1e1;'>";
echo "<tr>";
echo "<td width='5%'></td>";
echo "<td width='30%'><b>Forum & Description</b></td>";
echo "<td width='7%' align='center'><b>Topics</b></td>";
echo "<td width='28%' align='center'>Last message</b></td>";
echo "</tr>";
echo "</table>";
While($forum = mysql_fetch_array($select2)){
$select3 = mysql_query("SELECT * FROM forum WHERE catid='".$forum['id']."'");
$aantal_topics = mysql_num_rows($select3);
$fora = mysql_fetch_array($select3);
//laatste berichten ophalen
$last_bericht1 = mysql_query("SELECT * FROM forum WHERE catid = '".$forum['id']."' ORDER BY laatste_datum DESC LIMIT 0,1")or die(mysql_error());
$last_bericht = mysql_fetch_array($last_bericht1);
$datum_reactie = time()-21600;
if($forum['gesloten'] == 1) { // Als het forum is gesloten
$forum_img = "forum_gesloten.gif";
$alt = "This forum is closed. Opening a new topic has been closed!";
}
elseif($last_bericht['laatste_datum'] > $datum_reactie){
$forum_img = "forum_map.gif";
$alt = "Something has been posted here for the last 6 hours.";
}
else{
$forum_img = "non_actief.gif";
$alt = "Nothing has been posted here for the last 6 hours";
}
if(empty($last_bericht['id'])){
echo "";
}
else{
$last_m = mysql_query("SELECT * FROM forum_reacties WHERE tid=".$last_bericht['id']." ORDER BY id DESC LIMIT 0,1")or die(mysql_error());
$last_o = mysql_fetch_array($last_m);
$last_m2 = mysql_query("SELECT * FROM players WHERE id = '".$last_o['poster']."'")or die(mysql_error());
$last_o2 = mysql_fetch_array($last_m2);
if(empty($last_o2['login'])){
$last_m3 = mysql_query("SELECT * FROM players WHERE id='".$last_bericht['poster']."'")or die(mysql_error());
$last_o3 = mysql_fetch_array($last_m3);
$reactie_poster = "<a href='".$site_url."?p=profile.php?id=".$last_o3['id']."'>".gebruiker($last_o3['login'])."</a>";
}
else{
$reactie_poster = "<a href='".$site_url."?p=profile.php?id=".$last_o2['id']."'>".gebruiker($last_o2['login'])."</a>";
}
}
$datum = explode(" ", $last_o['datum']);
$datum2 = explode(" ", $last_bericht['datum']);
if(empty($datum[0])){
$da = explode(":", $datum2[0]);
$date = $da[0];
$date.= $da[1];
$date.= $da[2];
}
else{
$date = $datum[0];
$db = explode(":", $datum[0]);
}
if(empty($datum[1])){
$date2 = $datum2[1];
}
else{
$date2 = $datum[1];
}
$laatste_topic = "By <i>".$reactie_poster."</i> on ".$date." <br> at ".$date2." <a href='?f=forum&actie=bekijken&topicid=".$last_bericht['id']."'><img border='0' src='inc/img/forum/laatste_bericht.gif' alt='View the topic!'></img></a>";
if(empty($last_bericht['onderwerp'])){
$last = "<b>No messages</b>";
}
else{
$last = $laatste_topic;
}
//einde reacties ophalen
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0' style='border-top: 1px solid #e1e1e1'>";
echo "<tr>";
echo "<td width='5%' align='center'><img border='0' src='inc/img/forum/".$forum_img."' alt='".$alt."'></td>";
echo "<td width='30%' onclick='window.location=?f=forum&actie=forum&id=".$forum['id']."'><b><a href='?f=forum&actie=forum&id=".$forum['id']."'>".$forum['naam']."</a></b><br><small>".ubb($forum['beschrijving'], $site_url)."</small></td>";
echo "<td width='7%'><center>".$aantal_topics."</center></td>";
echo "<td width='28%'><center>".$last."</center></td>";
echo "</tr>";
echo "</table>";
}
}
echo "</div></div></div>";
echo "<br>";
echo "<div id=\"messageInfo\">Forum Legenda";
echo "<table border='0' cellspacing='3' cellpadding='0'>";
echo "<tr>";
echo "<td width='20%' align='center'><img border='0' alt='New messages' src='inc/img/forum/forum_map.gif'></td>";
echo "<td>New messages</td>";
echo "<td width='20%' align='center'><img border='0' alt='No new messages' src='inc/img/forum/non_actief.gif'></td>";
echo "<td>No new messages</td>";
echo "<td width='20%' align='center'><img border='0' alt='Closed forum' src='inc/img/forum/forum_gesloten.gif'></td>";
echo "<td>Closed forum</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
} //sluit actie leeg
if($_GET['actie'] == "forum") {
$sql = mysql_query("SELECT * FROM forum WHERE catid='".$_GET['id']."' ORDER BY id DESC");
$bestaat = mysql_num_rows($sql);
$sql2 = mysql_query("SELECT * FROM forum_sub_cats WHERE id='".$_GET['id']."'");
$crew = mysql_fetch_array($sql2);
if($crew['crew'] == 1 && functie() < 2){
echo "<div id='messageBad'>Error<br/>";
echo "You have no access to view this forum.";
echo "</div>";
}
else{
echo "<div class=\"news\"><div class=\"cBoxHeader\"><h2><b>Forum</b></h2></div> <div class=\"cBoxBg\">
<div class=\"cBoxText\">";
if($crew['post_crew'] == 1){
if(functie() < 2){
echo "[ Crew may only add topics ]<br>";
}
else{
echo "<a href='?f=nieuw_topic&catid=".$_GET['id']."' alt='Open a new topic'>[ New topic ]</a><br>";
}
}
else{
echo "<a href='?f=nieuw_topic&catid=".$_GET['id']."' alt='Open a new topic'>[ New topic ]</a><br>";
}
if($bestaat == 0){
echo "<br>There were <b>no</b> topics found!";
}
else{
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='4%'></td>";
echo "<td width='30%'><b>Subject</b></td>";
echo "<td width='20%'><b>Author</b></td>";
echo "<td width='10%'><b>Replies</b></td>";
echo "<td width='20%'><b>Last Reply</b></td>";
echo "</tr>";
WHILE($list = mysql_fetch_array($sql)){
$sql812 = mysql_query("SELECT * FROM players WHERE id='".$list['poster']."'")or die(mysql_error());
$kijker = mysql_fetch_array($sql812);
//Aantal reacties
$aantal_reacties_1 = mysql_query("SELECT * FROM forum_reacties WHERE tid='".$list['id']."'")or die(mysql_error());
$aantal_reacties = mysql_num_rows($aantal_reacties_1);
//Laatste reactie
$skoel123 = mysql_query("SELECT * FROM forum_reacties WHERE tid='".$list['id']."' ORDER BY id DESC LIMIT 0,1")or die(mysql_error());
$nieuwste_aantal = mysql_num_rows($skoel123);
$nieuwste = mysql_fetch_array($skoel123);
if($nieuwste_aantal == 0){
$nieuw = "N.v.t";
}
else{
$nieuw = $nieuwste['datum'];
}
if($list['poll'] == 1 && $list['status'] == "gesloten"){
$img = "gesloten_poll.gif";
$alt = "Closed poll";
}
elseif($list['poll'] == 1){
$img = "poll.gif";
$alt = "Topic with poll";
}
elseif($list['status'] == "gesloten"){
$img = "gesloten.gif";
$alt = "Closed topic!";
}
elseif($list['mededeling'] == 1){
$img = "sticky.gif";
$alt = "Sticky!";
}
else{
$gelezen = explode(",", $list['gelezen']);
if(in_array($_SESSION['id'], $gelezen)){
$img = "gelezen_topic.gif";
$alt = "Read topic";
}
else{
$img = "niet_gelezen_topic.gif";
$alt = "Unread topic";
}
}
echo "<tr>";
echo "<td width='4%' align='center'><img border='0' alt='".$alt."' src='inc/img/forum/".$img."'></td>";
echo "<td width='30%'><a href='?f=forum&actie=bekijken&topicid=".$list['id']."'>".$list['onderwerp']."</a></td>";
echo "<td width='20%'><a href='?p=profile&id=".$kijker['id']."'>".gebruiker($kijker['login'])."</a></td>";
echo "<td width='10%'>".$aantal_reacties."</td>";
echo "<td width='20%'>".$nieuw."</td>";
echo "</tr>";
}
echo "</table>";
}
echo "<br>";
echo "<h2>Extra</h2>";
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='50%'>";
echo "<img border='0' alt='Gelezen topic' src='inc/img/forum/gelezen_topic.gif'> Read topic.<br>";
echo "<img border='0' alt='Gelezen topic' src='inc/img/forum/niet_gelezen_topic.gif'> Unread topic.<br>";
echo "<img border='0' alt='Gelezen topic' src='inc/img/forum/gesloten.gif'> Closed topic<br>";
echo "<img border='0' alt='Gelezen topic' src='inc/img/forum/sticky.gif'> Sticky<br>";
echo "</td>";
echo "<td width='50%'> </td>";
echo "</tr>";
echo "</table></div></div></div>";
}
} //einde
if($_GET['actie'] == "bekijken"){
$sql = mysql_query("SELECT * FROM forum WHERE id='".$_GET['topicid']."'")or die(mysql_error());
$bestaat = mysql_num_rows($sql);
$list = mysql_fetch_array($sql);
echo <<<ENDHTML
<div class="news">
<div class="cBoxHeader"><h2><b>{$list['onderwerp']}</b></h2></div>
<div class="cBoxBg">
<div class="cBoxText">
ENDHTML;
if($bestaat == 0){
echo "<span class='bold'>Forum > View topic</span><br />";
echo "The topic does not exist (anymore)!";
}
else{
$sql2 = mysql_query("SELECT * FROM forum_sub_cats WHERE id='".$list['catid']."'")or die(mysql_error());
$crew = mysql_fetch_array($sql2);
if($_SESSION['id'] != ""){
$exploden = explode(",", $list['gelezen']);
if(in_array($_SESSION['id'], $exploden)){
echo "";
}
else{
$nieuw_gelezen = $list['gelezen'];
$nieuw_gelezen.= ",".$_SESSION['id'];
mysql_query("UPDATE forum SET gelezen='".$nieuw_gelezen."' WHERE id='".$_GET['topicid']."'")or die(mysql_error());
}
}
if($crew['crew'] == 1 && functie() <= 2){
echo "<span class='bold'>Forum > View topic</span><br />";
echo "You do not have access to view this forum";
}
else{
if(functie() > 1){
echo "<b>Adminoptions:</b><br>";
if($list['status'] == "gesloten"){
echo "<img border='0' alt='Dit topic openen' src='inc/img/forum/admin_openen.gif'> <a href='?f=forum_admin&actie=openen&topicid=".$_GET['topicid']."'>Re-open topic</a><br>";
}
else{
echo "<img border='0' alt='Dit topic sluiten' src='inc/img/forum/admin_sluiten.gif'> <a href='?f=forum_admin&actie=sluiten&topicid=".$_GET['topicid']."'>Close topic</a><br>";
}
echo "<br/>";
if($list['mededeling'] == "1") {
echo "<img border='0' alt='Dit topic openen' src='inc/img/forum/admin_openen.gif'> <a href='?f=forum_admin&actie=a_mededeling&id=".$_GET['topicid']."'>Normal topic</a><br>";
}else{
echo "<img border='0' alt='Dit topic openen' src='inc/img/forum/admin_openen.gif'> <a href='?f=forum_admin&actie=m_mededeling&id=".$_GET['topicid']."'>Sticky</a><br>";
}
echo "<br>";
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='50%'>";
if($list['status'] == "gesloten"){
$status_list = "<font color='red'>Closed</font>";
}
else{
$status_list = "<font color='green'>Open</font>";
}
echo "<b>Reacties</b> ".mysql_num_rows(mysql_query("SELECT * FROM forum_reacties WHERE tid='".$_GET['topicid']."'"))."<br>";
echo "<b>Status</b> ".$status_list;
echo "</td>";
echo "<td width='50%'>";
if($list['status'] == "gesloten"){
echo "Replying is no longer possible!<br>";
}
else{
echo "(<a href='#reageren'>Quick</a>)<a href='?f=forum_reageren&forum_id=".$_GET['topicid']."'>Reply</a><br>";
}
echo "<a href='?f=forum_tracker&id=".$_GET['topicid']."'>Save in TopicTracker(TT)!</a>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' colspan='2'>".$nav."</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
}
else{
echo "<strong>Extra</strong>";
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='50%'>";
if($list['status'] == "gesloten"){
$status_list = "<font color='red'>Closed</font>";
}
else{
$status_list = "<font color='green'>Open</font>";
}
echo "<b>Reacties</b> ".mysql_num_rows(mysql_query("SELECT * FROM forum_reacties WHERE tid='".$_GET['topicid']."'"))."<br>";
echo "<b>Status</b> ".$status_list;
echo "</td>";
echo "<td width='50%'>";
if($list['status'] == "gesloten"){
echo "Replying is no longer possible!<br>";
}
elseif($_SESSION['id'] != ""){
echo "(<a href='#reageren'>Quick</a>)<a href='?f=forum_reageren&forum_id=".$_GET['topicid']."'>Reply</a><br>";
}
if($_SESSION['id'] != ""){
echo "<a href='?f=forum_tracker&id=".$_GET['topicid']."'>Save in TopicTracker(TT)!</a>";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' colspan='2'>".$nav."</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
}
//poll
if($list['poll'] == 1){
include "inc/php/forum/forum_poll.php";
forum_poll($list['id'], $site_url, $thema);
}
else{
echo "";
}
echo "<strong>".$list['naam']."</strong>";
$sel123 = mysql_query("SELECT * FROM players WHERE id='".$list['poster']."'")or die(mysql_error());
$show123 = mysql_fetch_object($sel123);
if($_SESSION['id'] != "" and $list['status'] != "gesloten"){
$knoppen = "<a href='?f=forum_reageren&forum_id=".$_GET['topicid']."'>Reply</a> - <a href='?f=forum_quote&topicid=".$_GET['topicid']."'>Quote</a> ";
}
else{
$knoppen = "Reply - Quote ";
}
$select12123 = mysql_query("SELECT * FROM players WHERE id='".$_SESSION['id']."'");
$check12123 = mysql_num_rows($select12123);
$check123 = mysql_fetch_object($select12123);
if($list['status'] == "gesloten"){
echo "[Closed topic]<br>";
}
elseif($_SESSION['id'] != ""){
echo "<br>";
}
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='100%' style='border: 1px solid rgb(186, 186, 186);'>";
if(online($list['poster']) == true){
$img = "<img border='0' src='".$site_url."/images/online.gif'> ";
}
else{
$img = "<img border='0' src='".$site_url."/images/offline.gif'> ";
}
if($list['poster'] == $_SESSION['id'] OR functie() > 1){
if($list['status'] != "gesloten"){
$beheer = "- <a href='?f=forum_bewerken&topic=".$_GET['topicid']."'>Edit</a>";
}
else{
$beheer = "";
}
}
else{
$beheer = "";
}
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='50%' bgcolor='#dcdcdc'>".$img."<a href='?p=profile&id=".$show123->id."'>".gebruiker($show123->login)."</a></td>";
echo "<td width='50%' bgcolor='#dcdcdc'>".$list['datum']."</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' valign='top'>";
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='20%' style='border-left: 1px solid rgb(186, 186, 186);' valign='top'>";
echo laatzien($list['poster'], $site_url);
echo "</td>";
echo "<td width='80%' style='border-left: 1px solid rgb(186, 186, 186);' valign='top'>";
echo ubb($list['bericht'], $site_url);
if($check12123 != "0"){
if($check123->optie_onderschrift != "1"){
echo "";
}
else{
if($show123->signature == ""){
echo "";
}
else{
echo "<hr>".ubb($show123->signature, $site_url);
}
}
}
else{
echo "<hr>".ubb($show123->signature, $site_url);
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' style='border: 1px solid rgb(186, 186, 186);' bgcolor='#dcdcdc'>";
echo $knoppen.$beheer;
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
$select_nu = mysql_query("SELECT * FROM forum_reacties WHERE tid='".$_GET['topicid']."'")or die(mysql_error());
$counter = mysql_num_rows($select_nu);
if($counter == "0"){
echo "There are no replies yet!";
}
else{
WHILE($reactie = mysql_fetch_array($select_nu)){
echo "<a name='".$reactie['id']."'>";
$sel1231 = mysql_query("SELECT * FROM players WHERE id='".$reactie['poster']."'")or die(mysql_error());
$show1231 = mysql_fetch_object($sel1231);
if($_SESSION['id'] != "" and $list['status'] != "gesloten"){
$knoppen = "<a href='?f=forum_reageren&forum_id=".$_GET['topicid']."'>Reply</a> - <a href='?f=forum_quote&reactieid=".$reactie['id']."&topic_id=".$_GET['topicid']."'>Quote</a> ";
}
else{
$knoppen = "Reply - Quote ";
}
$select121231 = mysql_query("SELECT * FROM players WHERE id='".$_SESSION['id']."'");
$check121231 = mysql_num_rows($select121231);
$check1231 = mysql_fetch_object($select121231);
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='100%' style='border: 1px solid rgb(186, 186, 186);'>";
if(online($reactie['poster']) == true){
$img = "<img border='0' src='".$site_url."/images/online.gif'> ";
}
else{
$img = "<img border='0' src='".$site_url."/images/offline.gif'> ";
}
if($reactie['poster'] == $_SESSION['id'] OR functie() > 1){
if($list['status'] != "gesloten"){
$beheer = "- <a href='?f=forum_bewerken&reactie=".$reactie['id']."'>Edit</a>";
}
else{
$beheer = "";
}
}
else{
$beheer = "";
}
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='50%' bgcolor='#dcdcdc'>".$img."<a href='?p=profile&id=".$show1231->id."'>".gebruiker($show1231->login)."</a></td>";
echo "<td width='50%' bgcolor='#dcdcdc'>".$reactie['datum']."</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' valign='top'>";
echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='20%' style='border-left: 1px solid rgb(186, 186, 186);' valign='top'>";
echo laatzien($reactie['poster'], $site_url);
echo "</td>";
echo "<td width='80%' style='border-left: 1px solid rgb(186, 186, 186);' valign='top'>";
echo ubb($reactie['bericht'], $site_url);
if($check121231 != "0"){
if($check1231->optie_onderschrift != 1){
echo "";
}
else{
if($show1231->signature == ""){
echo "";
}
else{
echo "<hr>".ubb($show1231->signature, $site_url);
}
}
}
else{
echo "<hr>".ubb($show1231->signature, $site_url);
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' style='border: 1px solid rgb(186, 186, 186);' bgcolor='#dcdcdc'>";
echo $knoppen.$beheer;
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
}
}
if($list['status'] == "gesloten" OR functie() == 0){
echo "";
}
echo "</div></div></div>";
}
}echo "</div></div></div>";
}
?>
Toon Meer
Maar het probleem is dat als ik naar een topic ga, en ik zie een reactie die rond 0:00:00 is geplaatst, dat die boven de andere staan, ik denk dat het aan de tijd check ligt.
ik hoop dat jullie me kunnen helpen 8-|
Mvg, AeroXbird :cheer: