Hallo,
Ik heb een forum die compleet werkt.
Nu zit ik met een nogal domme vraag:
Hoe verander ik het aantal posts op per pagina?
Moet dit in de MYSQL of PHP?
Hier volgt de php van mijn forum:
Code:<?php if(isset($_GET['showtopic'])){ $tQuery = mysql_query("SELECT * FROM topics WHERE id = '" . mysql_real_escape_string($_GET['showtopic']) . "'") or die(mysql_error()); $tFetch = mysql_fetch_assoc($tQuery); if(mysql_num_rows($tQuery) == 0){ echo '<div id="error">Dit topic bestaat niet</div>'; }elseif($tFetch['type'] == 4){ echo '<div id="error">Dit topic is verwijderd</div>'; }else{ $records = 10; if(isset($_GET['page']) && ctype_digit($_GET['page'])){ $p = $_GET['page']; }else{ $p = 0; } $tsQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($tFetch['author']) . "'") or die(mysql_error()); $tsFetch = mysql_fetch_assoc($tsQuery); $tsOnlineQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($tFetch['author']) . "' AND DATE_SUB(NOW(),INTERVAL 5 MINUTE) <= last_online") or die(mysql_error()); if(mysql_num_rows($tsOnlineQuery) == 0){ $plaatje = 'bullet_red'; }else{ $plaatje = 'bullet_green'; } $tsPostCountQuery = mysql_query("SELECT * FROM forumreactions WHERE author = '" . mysql_real_escape_string($tsFetch['id']) . "'") or die(mysql_error()); ?> <h1><?php echo stripslashes($tFetch['title']); ?></h1> <div style="width: 100%; border: 1px solid #EAEAEA; padding: 2px; background: url(img/forummessage.png) #FFFFFF repeat-x;"> <table style="border: 0; width: 100%;"> <tr> <td></td> <td style="text-align: right;"> Geplaatst op <?php echo datenl($tFetch['date_posted']); ?> </td> </tr> <tr> <td style="width: 16%; text-align: center;" valign="top"> <strong><?php if($tsFetch['type'] != 5){ ?><img src="img/<?php echo $plaatje; ?>.gif" /><?php } ?> <a target="_blank" <?php if($tsFetch['type'] == 5){ echo 'style="font-style: italic; color: #969696;" '; } ?>href="http://<?php echo $tsFetch['username']; ?>.Challas.nl"><?php if($tsFetch['type'] == 5){ echo '<img src="img/robot.png" /> '; } echo $tsFetch['username']; ?></strong><br /> <img src="<?php if(@file_exists('img/avatars/'.$tsFetch['username'].'.'.$tsFetch['avatar_type'])){ echo 'img/avatars/'.$tsFetch['username'].'.'.$tsFetch['avatar_type']; }else{ echo 'img/noavatar.jpg'; } ?>" style="width: 100px; height: 100px;"/></a><br /> Rank: <?php if($tsFetch['type'] == 1){ echo 'Lid'; }elseif($tsFetch['type'] == 5){ echo 'Robot'; } elseif($tsFetch['type'] == 2){ echo '<span style="color: darkgreen; font-weight: bold;">Moderator</span>'; }elseif($tsFetch['type'] == 3){ echo '<span style="color: red; font-weight: bold;">Beheerder</span>'; }elseif($tsFetch['type'] == 4){ echo ''; } ?><br /> Posts: <?php echo mysql_num_rows($tsPostCountQuery); ?><br /> Karma: <span id="karma<?php echo $tsFetch['id']; ?>"><?php echo $tsFetch['karma']; ?></span> </td> <td valign="top" style="background:#FFFFFF; padding: 4px;"> <?php if($team == 1){ ?> <div id="forumAction"><a href="?p=admin&sticky=<?php echo $tFetch['id']; ?>"><img src="img/exclamation.png" /></a></div><div id="forumAction"><a href="?p=admin&lock=<?php echo $tFetch['id']; ?>"><img src="img/lock.gif" /></a></div><div id="forumAction"><a href="#" onclick="var c = confirm('Weet je het zeker?'); if(c == true){ location.href = '?p=admin&deletetopic=<?php echo $tFetch['id']; ?>'; }"><img src="img/delete.gif" /></a></div> <?php } ?> <br /> <?php if($tsFetch['type'] == 4){ echo '<span style="color: red;">Deze gebruiker is verwijderd.</span><br />'; } ?> <br /> <?php echo ubb(stripslashes($tFetch['message'])); ?> <?php if($tsFetch['signature'] != '') { ?><br /><br /> <div style="height: 1px; width: 100%; background: #EEEEEE;"></div><br /> <?php echo ubb(stripslashes($tsFetch['signature'])); ?> <?php } ?> </td> </tr> </table> </div> <br /><br /> <?php $aQuery = mysql_query("SELECT * FROM ads WHERE vertical = 0 AND horizontal = 1 ORDER BY RAND() LIMIT 1") or die(mysql_error()); $aFetch = mysql_fetch_assoc($aQuery); ?> <center><a href="index.php?p=ad&id=<?php echo $aFetch['id']; ?>"><img src="img/ads/<?php echo $aFetch['id']; ?>.<?php echo $aFetch['filetype']; ?>" /></a></center> <br /> <?php $allReactionsQuery = mysql_query("SELECT * FROM forumreactions WHERE topic_id = '" . mysql_real_escape_string($tFetch['id']) . "' AND NOT type=0") or die(mysql_error()); $allReactionsRows = mysql_num_rows($allReactionsQuery); $pages = ceil($allReactionsRows / $records); for($i = 1; $i <= $pages; $i++) { if($i-1 == $p){ $style = 'border: 1px solid #99B837; background: #B0CD58; padding: 4px; color: #FFFFFF; font-weight: bold;'; }else{ $style = 'border: 1px solid #969696; background: #FFFFFF; padding: 4px; color: #969696;'; } echo '<button style="' . $style . '" onclick="location.href = \'?p=forum&showtopic=' . mysql_real_escape_string($_GET['showtopic']) . '&page='.($i-1).'\';">'.$i.'</button> '; } ?> <br /><br /> <?php $rQuery = mysql_query("SELECT * FROM forumreactions WHERE topic_id = '" . mysql_real_escape_string($tFetch['id']) . "' AND type = 1 LIMIT ".($p*$records).",".$records."") or die(mysql_error()); while($rFetch = mysql_fetch_assoc($rQuery)){ $ruQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($rFetch['author']) . "'") or die(mysql_error()); $ruFetch = mysql_fetch_assoc($ruQuery); $ruOnlineQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($rFetch['author']) . "' AND DATE_SUB(NOW(),INTERVAL 5 MINUTE) <= last_online") or die(mysql_error()); if(mysql_num_rows($ruOnlineQuery) == 0){ $plaatje = 'bullet_red'; }else{ $plaatje = 'bullet_green'; } $postCountQuery = mysql_query("SELECT * FROM forumreactions WHERE author = '" . $ruFetch['id'] . "'") or die(mysql_error()); ?> <div style="width: 100%; border: 1px solid #EAEAEA; padding: 2px; background: url(img/forummessage.png) #FFFFFF repeat-x;" id="reaction<?php echo $rFetch['id']; ?>"> <table style="border: 0; width: 100%;"> <tr> <td></td> <td style="text-align: right;"> Geplaatst op <?php echo datenl($rFetch['date_posted']); ?> </td> </tr> <tr> <td style="width: 16%; text-align: center;" valign="top"> <strong><?php if($ruFetch['type'] != 5){ ?><img src="img/<?php echo $plaatje; ?>.gif" /><?php } ?> <a target="_blank" <?php if($ruFetch['type'] == 5){ echo 'style="font-style: italic; color: #969696;" '; } ?>href="http://<?php echo $ruFetch['username']; ?>.Challas.nl"><?php if($ruFetch['type'] == 5){ echo '<img src="img/robot.png" /> '; } echo $ruFetch['username']; ?></strong><br /> <img src="<?php if(@file_exists('img/avatars/'.$ruFetch['username'].'.'.$ruFetch['avatar_type'])){ echo 'img/avatars/'.$ruFetch['username'].'.'.$ruFetch['avatar_type']; }else{ echo 'img/noavatar.jpg'; } ?>" style="width: 100px; height: 100px;"/></a><br /> Rank: <?php if($ruFetch['type'] == 1){ echo 'Lid'; }elseif($ruFetch['type'] == 5){ echo 'Robot'; } elseif($ruFetch['type'] == 2){ echo '<span style="color: darkgreen; font-weight: bold;">Moderator</span>'; }elseif($ruFetch['type'] == 3){ echo '<span style="color: red; font-weight: bold;">Beheerder</span>'; }elseif($ruFetch['type'] == 4){ echo 'Verwijderd'; } ?><br /> Posts: <?php echo mysql_num_rows($postCountQuery); ?><br /> Karma: <span id="karma<?php echo $ruFetch['id']; ?>"><?php echo $ruFetch['karma']; ?></span> </td> <td valign="top" style="background:#FFFFFF; padding: 4px;"> <?php if(isset($_SESSION['id'])){ if(!isset($_SESSION['karma' . $ruFetch['id']])) { if($_SESSION['id'] != $rFetch['author']) { ?> <div id="forumAction" class="forum_karma<?php echo $ruFetch['id']; ?>"><a onclick="give_karma(<?php echo $ruFetch['id']; ?>)"><img src="img/good.png" onclick="$('.forum_karma<?php echo $ruFetch['id']; ?>').fadeOut('slow');" /></a></div> <?php } } } if(isset($_SESSION['id'])){ ?><div id="forumAction"><a href="?p=forum"e=<?php echo $rFetch['id']; ?>"><img src="img/comments.png" /></a></div> <?php } if(isset($_SESSION['id']) && $rFetch['author'] == $_SESSION['id'] or $team == 1){ ?><div id="forumAction"><a href="?p=forum&edit=<?php echo $rFetch['id']; ?>"><img src="img/edit.gif" /></a></div> <?php } if($team == 1){ ?> <div id="forumAction"><a onclick="var c = confirm('Weet je het zeker?'); if(c == true) { delete_forumreaction(<?php echo $rFetch['id']; ?>); }"><img src="img/delete.gif" /></a></div> <?php } ?> <br /> <?php if($ruFetch['type'] == 4){ echo '<span style="color: red;">Deze gebruiker is verwijderd.</span><br />'; } ?> <br /> <?php echo ubb(stripslashes($rFetch['message'])); ?> <?php if($ruFetch['signature'] != '') { ?><br /><br /> <div style="height: 1px; width: 100%; background: #EEEEEE;"></div><br /> <?php echo ubb(stripslashes($ruFetch['signature'])); ?> <?php } ?> </td> </tr> </table> </div><br /> <?php } for($i = 1; $i <= $pages; $i++) { if($i-1 == $p){ $style = 'border: 1px solid #99B837; background: #B0CD58; padding: 4px; color: #FFFFFF; font-weight: bold;'; }else{ $style = 'border: 1px solid #969696; background: #FFFFFF; padding: 4px; color: #969696;'; } echo '<button style="' . $style . '" onclick="location.href = \'?p=forum&showtopic=' . mysql_real_escape_string($_GET['showtopic']) . '&page='.($i-1).'\';">'.$i.'</button> '; } echo '<br /><br />'; if(isset($_POST['submit'])){ if(strlen($_POST['message']) < 3){ echo '<div id="error">Je bericht is te kort!</div>'; }elseif($tFetch['type'] == 2 or $tFetch['type'] == 4){ echo '<div id="error">Je kan niet op dit topic reageren!</div>'; }elseif(!isset($_SESSION['id'])){ echo '<div id="error">Log in als je op een topic wilt reageren!</div>'; }else{ $message = htmlspecialchars($_POST['message']); $message = nl2br($message); mysql_query("INSERT INTO forumreactions VALUES ( NULL, '" . mysql_real_escape_string($tFetch['id']) . "', '" . mysql_real_escape_string($message) . "', '" . $_SESSION['id'] . "', 1, NOW() ); ") or die(mysql_error()); mysql_query("UPDATE topics SET last_reaction = NOW() WHERE id = '" . mysql_real_escape_string($tFetch['id']) . "'") or die(mysql_error()); ?> <a id="bottom"> </a> <meta http-equiv="refresh" content="0;url=<?php echo '?p=forum&showtopic=' . $tFetch['id'] . '&page=' . $_POST['p']; ?>#bottom"> <?php } }else{ if($tFetch['type'] == 2){ echo '<div id="error"><img src="img/slotje.gif" /> Dit topic is gesloten, je kunt niet reageren.</div>'; }elseif(!isset($_SESSION['id'])){ echo '<div id="error">Log in als je op een topic wilt reageren!</div>'; }else{ ?> <a id="bottom"></a> <table style="border: 0;"> <tr> <td style="width: 250px;" valign="top"> <?php ubbbuttons('message'); ?> </td> <td valign="top"> <form method="post" action="?p=forum&showtopic=<?php echo $tFetch['id']; ?>#bottom"> <textarea style="width: 450px; height: 170px;" name="message" id="message"></textarea> <input type="hidden" name="p" value="<?php echo $p; ?>" /> </td> </tr> </table> <br /><br /> <input type="submit" value="Versturen" name="submit" /> </form> <?php } } } }elseif(isset($_GET['maketopic']) && isset($_SESSION['id'])){ ?> <h1>Topic aanmaken</h1> <?php $lastPostQuery = mysql_query("SELECT * FROM topics WHERE NOT type = 4 ORDER BY id DESC LIMIT 1") or die(mysql_error()); $lastPostFetch = mysql_fetch_assoc($lastPostQuery); if($lastPostFetch['author'] == $_SESSION['id']){ die('<div id="error">Je mag maar 1 topic na elkaar maken!</div>'); } $cQuery = mysql_query("SELECT * FROM cats WHERE id = '" . mysql_real_escape_string($_GET['maketopic']) . "'"); $cFetch = mysql_fetch_assoc($cQuery); if(mysql_num_rows($cQuery) == 0){ echo '<div id="error">Deze categorie bestaat niet</div>'; }elseif($cFetch['allowed'] == 0 and $team == 0){ echo '<div id="error">Je mag geen topics aanmaken in deze categorie!</div>'; }else{ if(isset($_POST['submit'])){ $message = htmlspecialchars($_POST['message']); $message = nl2br($message); if(strlen($message) < 3){ echo '<div id="error">Je bericht is te kort!</div>'; }elseif(strlen($_POST['title']) < 3){ echo '<div id="error">Je titel is te kort!</div>'; }else{ mysql_query("INSERT INTO topics VALUES ( NULL, '" . mysql_real_escape_string(htmlspecialchars($_POST['title'])) . "', '" . $_SESSION['id'] . "', '" . mysql_real_escape_string($message) . "', 1, NOW(), '" . $cFetch['id'] . "', NOW() ); ") or die(mysql_error()); $gQuery = mysql_query("SELECT * FROM topics WHERE author = '" . $_SESSION['id'] . "' ORDER BY id DESC LIMIT 1"); $gFetch = mysql_fetch_assoc($gQuery); echo '<div id="succes">Het topic is aangemaakt! <a href="?p=forum&showtopic=' . $gFetch['id'] . '">Klik hier</a></div>'; } } ?> <table style="border: 0;"> <tr> <td style="width: 120px;" valign="top"> UBB: </td> <td valign="top"> <?php ubbbuttons('message'); ?> </td> </tr> <form method="post" action="?p=forum&maketopic=<?php echo $cFetch['id']; ?>"> <tr> <td style="width: 120px;" valign="top"> Titel: </td> <td valign="top"> <input type="text" name="title" /> </td> </tr> <tr> <td style="width: 120px;" valign="top"> Bericht: </td> <td valign="top"> <textarea name="message" id="message"></textarea> </td> </tr> </table> <br /> <input type="submit" value="Topic aanmaken" name="submit" /> </form> <?php } }elseif(isset($_GET['cat'])){ $cQuery = mysql_query("SELECT * FROM cats WHERE id = '" . mysql_real_escape_string($_GET['cat']) . "'"); $cFetch = mysql_fetch_assoc($cQuery); if(mysql_num_rows($cQuery) == 0){ echo '<div id="error">Deze categorie bestaat niet</div>'; }else{ $tQuery = mysql_query("SELECT * FROM topics WHERE catid = '" . mysql_real_escape_string($_GET['cat']) . "' AND NOT type = '4'") or die(mysql_error()); ?> <h1>Topics</h1> <div style="border: 1px solid #CCCCCC; padding: 3px; width: 100%;"> <table style="border: 0; width: 100%;"> <tr> <td></td> <td>Titel</td> <td>Door</td> <td>Geplaatst op</td> <td>Laatste reactie</td> </tr> <?php while($tFetch = mysql_fetch_assoc($tQuery)){ $uQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($tFetch['author']) . "'") or die(mysql_error()); $uFetch = mysql_fetch_assoc($uQuery); ?> <tr> <td><img src="img/<?php if($tFetch['type'] == 1){ echo 'topic.png'; }elseif($tFetch['type'] == 2){ echo 'lock.gif'; }elseif($tFetch['type'] == 3){ echo 'sticky.png'; } ?>" /></td> <td><a href="?p=forum&showtopic=<?php echo $tFetch['id']; ?>"><?php echo stripslashes($tFetch['title']); ?></a></td> <td><a target="_blank" href="http://<?php echo $uFetch['username']; ?>.Challas.nl/"><?php echo $uFetch['username']; ?></a></td> <td><?php echo datenl($tFetch['date_posted']); ?></td> <td><?php echo datenl($tFetch['last_reaction']); ?></td> </tr> <?php } ?> </table> </div> <?php if(isset($_SESSION['id'])){ ?> <br /> <a href="?p=forum&maketopic=<?php echo $cFetch['id']; ?>">Maak een topic</a> <?php } } }elseif(isset($_GET['quote']) && isset($_SESSION['id'])){ echo '<h1>Quote</h1>'; $bQuery = mysql_query("SELECT * FROM forumreactions WHERE id = '" . mysql_real_escape_string($_GET['quote']) . "'") or die(mysql_error()); $bFetch = mysql_fetch_assoc($bQuery); $tQuery = mysql_query("SELECT * FROM topics WHERE id = '" . mysql_real_escape_string($bFetch['topic_id']) . "'") or die(mysql_error()); $tFetch = mysql_fetch_assoc($tQuery); if(mysql_num_rows($bQuery) == 0){ echo '<div id="error">Dit bericht bestaat niet!</div>'; }elseif($tFetch['type'] == 2 or $tFetch['type'] == 4){ echo '<div id="error">Je kunt niet reageren op dit topic.'; }else{ if(isset($_POST['submit'])){ $message = htmlspecialchars($_POST['quote']); $message = nl2br($message); mysql_query("INSERT INTO forumreactions VALUES ( NULL, '" . mysql_real_escape_string($bFetch['topic_id']) . "', '" . mysql_real_escape_string($message) . "', '" . $_SESSION['id'] . "', 1, NOW() ); ") or die(mysql_error()); mysql_query("UPDATE topics SET last_reaction = NOW() WHERE id = '" . mysql_real_escape_string($bFetch['topic_id']) . "'") or die(mysql_error()); echo '<div id="succes">Je bericht is geplaatst! <a href="?p=forum&showtopic=' . $bFetch['topic_id'] . '">Klik hier</a></div>'; } $uQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($bFetch['author']) . "'") or die(mysql_error()); $uFetch = mysql_fetch_assoc($uQuery); ubbbuttons('msg'); ?> <form method="post" action="?p=forum"e=<?php echo $bFetch['id']; ?>"> <textarea id="msg" name="quote" style="width: 500px; height: 200px;">Typ hier je bericht </textarea> <br /><br /> <input type="submit" name="submit" value="Versturen!" /> </form> <?php } }elseif(isset($_GET['edit']) && isset($_SESSION['id'])){ $bQuery = mysql_query("SELECT * FROM forumreactions WHERE id = '" . mysql_real_escape_string($_GET['edit']) . "'") or die(mysql_error()); $bFetch = mysql_fetch_assoc($bQuery); if($team == 0){ if($bFetch['author'] != $_SESSION['id']){ echo '<div id="error">Je mag dit bericht niet aanpassen.</div>'; die(); } } $uQuery = mysql_query("SELECT * FROM users WHERE id = '" . $_SESSION['id'] . "'") or die(mysql_error()); $uFetch = mysql_fetch_assoc($uQuery); ?> <h1>Bericht veranderen</h1> <?php if(mysql_num_rows($bQuery) == 0){ echo '<div id="error">Dit bericht bestaat niet!</div>'; }else{ if(isset($_POST['submit'])){ $message = htmlspecialchars($_POST['edit']); $message = nl2br($message); mysql_query("UPDATE forumreactions SET message = '" . mysql_real_escape_string($message) . "<br /><br />Laatst aangepast door " . $uFetch['username'] . " om " . date('Y-m-d H:i:s') . "' WHERE id = '" . mysql_real_escape_string($_GET['edit']) . "'") or die(mysql_error()); echo '<div id="succes">Het bericht is aangepast! <a href="?p=forum&showtopic=' .$bFetch['topic_id'] . '">Klik hier</a></div>'; } ubbbuttons('edit'); ?> <form method="post" action="?p=forum&edit=<?php echo $_GET['edit']; ?>"> <textarea name="edit" id="edit" style="width: 500px; height: 200px;"><?php echo stripslashes(str_replace('<br />', '', $bFetch['message'])); ?></textarea><br /> <input type="submit" name="submit" value="Aanpassen" /> </form> <?php } }elseif(isset($_GET['karma']) && isset($_SESSION['id'])){ $uQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($_GET['karma']) . "'") or die(mysql_error()); $uFetch = mysql_fetch_assoc($uQuery); if(mysql_num_rows($uQuery) > 0){ if(isset($_SESSION['karma' . $uFetch['id']])){ echo 'Je kan niet 2x stemmen op dezelfde persoon!'; }elseif($uFetch['id'] == $_SESSION['id']){ echo 'Je kan niet op jezelf stemmen!'; }else{ mysql_query("UPDATE users SET karma = karma + 1 WHERE id = '" . mysql_real_escape_string($_GET['karma']) . "'") or die(mysql_error()); $_SESSION['karma' . $uFetch['id']] = true; echo 'Karma gegeven!'; } }else{ echo 'Gebruiker bestaat niet'; } }else{ ?> <h1>Forum</h1> <?php $cQuery = mysql_query("SELECT * FROM cats"); while($cFetch = mysql_fetch_assoc($cQuery)){ ?> <div style="border: 1px solid #CCCCCC; padding: 3px; width: 100%;"> <a href="?p=forum&cat=<?php echo $cFetch['id']; ?>"> <span style="font-size: 15px;"><?php echo stripslashes($cFetch['title']); ?></span><br /> <?php echo stripslashes($cFetch['description']); ?> </a> </div> <br /> <?php } } ?><?php echo stripslashes(str_replace('<br />', '', $bFetch['message'])); ?>
- Werkend forum, maar hoe moet dit?
-
22-07-2011, 20:57 #1
- Berichten
- 116
- Lid sinds
- 13 Jaar
Werkend forum, maar hoe moet dit?
-
In de schijnwerper
Startpagina script V2.1 - WP plugin - Vernieuwd - Vele opties - V2.1 NU LIVEPHP scriptsServerFIX| 24/7 server beheer | 24/7 NOC | Urgente storingsopvolging | Netwerk beheerFreelance / WerkFull Stack: Web development, Design and BrandingFreelance / WerkWebhostingbedrijven of klanten ter overnameHosting -
22-07-2011, 21:02 #2
- Berichten
- 64
- Lid sinds
- 16 Jaar
Re: Werkend forum, maar hoe moet dit?
Heb er zelf nie veel mee te doen maar ik knooi er afentoe mee,
Kunst in mee gaan spelen en zo stapje voor stapje er komen ;)
Of iemand inhuren die er verstand van heeft.
Maar probeer is met:
$records = 10;
Te spelen, of te tellen hoeveel posten er op die ene page staan en kijken of het overeenkomt met getallen in de script of in de DB of dergelijke.
-
22-07-2011, 22:59 #3
- Berichten
- 116
- Lid sinds
- 13 Jaar
Re: Werkend forum, maar hoe moet dit?
Dankjewel, ik ga het proberen.
-
22-07-2011, 23:06 #4
- Berichten
- 1.263
- Lid sinds
- 16 Jaar
Re: Werkend forum, maar hoe moet dit?
Hiervoor zul je een navigatie class moeten schrijven/gebruiken.. Maar aangezien je code volledig procedureel gescript is hier niet echt aan te beginnen..
De kunst is om een LIMIT op je query dynamisch te laten werken, dus; 'haal de 10 eerste posts op', 'skip de eerste 10 posts, en haal vervolgens de 10 daaropvolgende posts op'
-
22-07-2011, 23:42 #5
- Berichten
- 75
- Lid sinds
- 16 Jaar
Re: Werkend forum, maar hoe moet dit?
Hiervoor zul je een navigatie class moeten schrijven/gebruiken.. Maar aangezien je code volledig procedureel gescript is hier niet echt aan te beginnen..
De kunst is om een LIMIT op je query dynamisch te laten werken, dus; 'haal de 10 eerste posts op', 'skip de eerste 10 posts, en haal vervolgens de 10 daaropvolgende posts op'
Wat je nu vertelt is toch het normale pagina systeem?
Maar om dat hier toe te passen is inderdaad onhandig, en veel te veel werk.
Gewoon lekker zo doen dus.
-
23-07-2011, 14:14 #6
- Berichten
- 943
- Lid sinds
- 15 Jaar
Re: Werkend forum, maar hoe moet dit?
PHP Code:$rQuery = mysql_query("SELECT * FROM forumreactions WHERE topic_id = '" . mysql_real_escape_string($tFetch['id']) . "' AND type = 1 LIMIT ".($p*$records).",".$records."") or die(mysql_error());
-
23-07-2011, 15:43 #7
- Berichten
- 116
- Lid sinds
- 13 Jaar
Re: Werkend forum, maar hoe moet dit?
Ik snap het niet meer :s
-
23-07-2011, 18:24 #8
- Berichten
- 75
- Lid sinds
- 16 Jaar
Re: Werkend forum, maar hoe moet dit?
Gebruik deze code werkt die?
PHP Code:<?php
if(isset($_GET['showtopic'])){
$tQuery = mysql_query("SELECT * FROM topics WHERE id = '" . mysql_real_escape_string($_GET['showtopic']) . "'") or die(mysql_error());
$tFetch = mysql_fetch_assoc($tQuery);
if(mysql_num_rows($tQuery) == 0){
echo '<div id="error">Dit topic bestaat niet</div>';
}elseif($tFetch['type'] == 4){
echo '<div id="error">Dit topic is verwijderd</div>';
}else{
$records = 20;
if(isset($_GET['page']) && ctype_digit($_GET['page'])){
$p = $_GET['page'];
}else{
$p = 0;
}
$tsQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($tFetch['author']) . "'") or die(mysql_error());
$tsFetch = mysql_fetch_assoc($tsQuery);
$tsOnlineQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($tFetch['author']) . "' AND DATE_SUB(NOW(),INTERVAL 5 MINUTE) <= last_online") or die(mysql_error());
if(mysql_num_rows($tsOnlineQuery) == 0){
$plaatje = 'bullet_red';
}else{
$plaatje = 'bullet_green';
}
$tsPostCountQuery = mysql_query("SELECT * FROM forumreactions WHERE author = '" . mysql_real_escape_string($tsFetch['id']) . "'") or die(mysql_error());
?>
<h1><?php echo stripslashes($tFetch['title']); ?></h1>
<div style="width: 100%; border: 1px solid #EAEAEA; padding: 2px; background: url(img/forummessage.png) #FFFFFF repeat-x;">
<table style="border: 0; width: 100%;">
<tr>
<td></td>
<td style="text-align: right;">
Geplaatst op <?php echo datenl($tFetch['date_posted']); ?>
</td>
</tr>
<tr>
<td style="width: 16%; text-align: center;" valign="top">
<strong><?php if($tsFetch['type'] != 5){ ?><img src="img/<?php echo $plaatje; ?>.gif" /><?php } ?> <a target="_blank" <?php if($tsFetch['type'] == 5){ echo 'style="font-style: italic; color: #969696;" '; } ?>href="[URL="http://%3c/?php"]http://<?php[/URL] echo $tsFetch['username']; ?>.Challas.nl"><?php if($tsFetch['type'] == 5){ echo '<img src="img/robot.png" /> '; } echo $tsFetch['username']; ?></strong><br />
<img src="<?php if(@file_exists('img/avatars/'.$tsFetch['username'].'.'.$tsFetch['avatar_type'])){ echo 'img/avatars/'.$tsFetch['username'].'.'.$tsFetch['avatar_type']; }else{ echo 'img/noavatar.jpg'; } ?>" style="width: 100px; height: 100px;"/></a><br />
Rank: <?php if($tsFetch['type'] == 1){ echo 'Lid'; }elseif($tsFetch['type'] == 5){ echo 'Robot'; } elseif($tsFetch['type'] == 2){ echo '<span style="color: darkgreen; font-weight: bold;">Moderator</span>'; }elseif($tsFetch['type'] == 3){ echo '<span style="color: red; font-weight: bold;">Beheerder</span>'; }elseif($tsFetch['type'] == 4){ echo ''; } ?><br />
Posts: <?php echo mysql_num_rows($tsPostCountQuery); ?><br />
Karma: <span id="karma<?php echo $tsFetch['id']; ?>"><?php echo $tsFetch['karma']; ?></span>
</td>
<td valign="top" style="background:#FFFFFF; padding: 4px;">
<?php
if($team == 1){
?>
<div id="forumAction"><a href="?p=admin&sticky=<?php echo $tFetch['id']; ?>"><img src="img/exclamation.png" /></a></div><div id="forumAction"><a href="?p=admin&lock=<?php echo $tFetch['id']; ?>"><img src="img/lock.gif" /></a></div><div id="forumAction"><a href="#" onclick="var c = confirm('Weet je het zeker?'); if(c == true){ location.href = '?p=admin&deletetopic=<?php echo $tFetch['id']; ?>'; }"><img src="img/delete.gif" /></a></div>
<?php
}
?>
<br />
<?php
if($tsFetch['type'] == 4){
echo '<span style="color: red;">Deze gebruiker is verwijderd.</span><br />';
}
?>
<br />
<?php echo ubb(stripslashes($tFetch['message'])); ?>
<?php if($tsFetch['signature'] != '') { ?><br /><br />
<div style="height: 1px; width: 100%; background: #EEEEEE;"></div><br />
<?php echo ubb(stripslashes($tsFetch['signature'])); ?>
<?php
}
?>
</td>
</tr>
</table>
</div>
<br /><br />
<?php
$aQuery = mysql_query("SELECT * FROM ads WHERE vertical = 0 AND horizontal = 1 ORDER BY RAND() LIMIT 1") or die(mysql_error());
$aFetch = mysql_fetch_assoc($aQuery);
?>
<center><a href="index.php?p=ad&id=<?php echo $aFetch['id']; ?>"><img src="img/ads/<?php echo $aFetch['id']; ?>.<?php echo $aFetch['filetype']; ?>" /></a></center>
<br />
<?php
$allReactionsQuery = mysql_query("SELECT * FROM forumreactions WHERE topic_id = '" . mysql_real_escape_string($tFetch['id']) . "' AND NOT type=0") or die(mysql_error());
$allReactionsRows = mysql_num_rows($allReactionsQuery);
$pages = ceil($allReactionsRows / $records);
for($i = 1; $i <= $pages; $i++) {
if($i-1 == $p){
$style = 'border: 1px solid #99B837; background: #B0CD58; padding: 4px; color: #FFFFFF; font-weight: bold;';
}else{
$style = 'border: 1px solid #969696; background: #FFFFFF; padding: 4px; color: #969696;';
}
echo '<button style="' . $style . '" onclick="location.href = \'?p=forum&showtopic=' . mysql_real_escape_string($_GET['showtopic']) . '&page='.($i-1).'\';">'.$i.'</button> ';
}
?>
<br /><br />
<?php
$rQuery = mysql_query("SELECT * FROM forumreactions WHERE topic_id = '" . mysql_real_escape_string($tFetch['id']) . "' AND type = 1 LIMIT ".($p*$records).",".$records."") or die(mysql_error());
while($rFetch = mysql_fetch_assoc($rQuery)){
$ruQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($rFetch['author']) . "'") or die(mysql_error());
$ruFetch = mysql_fetch_assoc($ruQuery);
$ruOnlineQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($rFetch['author']) . "' AND DATE_SUB(NOW(),INTERVAL 5 MINUTE) <= last_online") or die(mysql_error());
if(mysql_num_rows($ruOnlineQuery) == 0){
$plaatje = 'bullet_red';
}else{
$plaatje = 'bullet_green';
}
$postCountQuery = mysql_query("SELECT * FROM forumreactions WHERE author = '" . $ruFetch['id'] . "'") or die(mysql_error());
?>
<div style="width: 100%; border: 1px solid #EAEAEA; padding: 2px; background: url(img/forummessage.png) #FFFFFF repeat-x;" id="reaction<?php echo $rFetch['id']; ?>">
<table style="border: 0; width: 100%;">
<tr>
<td></td>
<td style="text-align: right;">
Geplaatst op <?php echo datenl($rFetch['date_posted']); ?>
</td>
</tr>
<tr>
<td style="width: 16%; text-align: center;" valign="top">
<strong><?php if($ruFetch['type'] != 5){ ?><img src="img/<?php echo $plaatje; ?>.gif" /><?php } ?> <a target="_blank" <?php if($ruFetch['type'] == 5){ echo 'style="font-style: italic; color: #969696;" '; } ?>href="[URL="http://%3c/?php"]http://<?php[/URL] echo $ruFetch['username']; ?>.Challas.nl"><?php if($ruFetch['type'] == 5){ echo '<img src="img/robot.png" /> '; } echo $ruFetch['username']; ?></strong><br />
<img src="<?php if(@file_exists('img/avatars/'.$ruFetch['username'].'.'.$ruFetch['avatar_type'])){ echo 'img/avatars/'.$ruFetch['username'].'.'.$ruFetch['avatar_type']; }else{ echo 'img/noavatar.jpg'; } ?>" style="width: 100px; height: 100px;"/></a><br />
Rank: <?php if($ruFetch['type'] == 1){ echo 'Lid'; }elseif($ruFetch['type'] == 5){ echo 'Robot'; } elseif($ruFetch['type'] == 2){ echo '<span style="color: darkgreen; font-weight: bold;">Moderator</span>'; }elseif($ruFetch['type'] == 3){ echo '<span style="color: red; font-weight: bold;">Beheerder</span>'; }elseif($ruFetch['type'] == 4){ echo 'Verwijderd'; } ?><br />
Posts: <?php echo mysql_num_rows($postCountQuery); ?><br />
Karma: <span id="karma<?php echo $ruFetch['id']; ?>"><?php echo $ruFetch['karma']; ?></span>
</td>
<td valign="top" style="background:#FFFFFF; padding: 4px;">
<?php
if(isset($_SESSION['id'])){
if(!isset($_SESSION['karma' . $ruFetch['id']]))
{
if($_SESSION['id'] != $rFetch['author'])
{
?>
<div id="forumAction" class="forum_karma<?php echo $ruFetch['id']; ?>"><a onclick="give_karma(<?php echo $ruFetch['id']; ?>)"><img src="img/good.png" onclick="$('.forum_karma<?php echo $ruFetch['id']; ?>').fadeOut('slow');" /></a></div>
<?php
}
}
}
if(isset($_SESSION['id'])){ ?><div id="forumAction"><a href="?p=forum"e=<?php echo $rFetch['id']; ?>"><img src="img/comments.png" /></a></div>
<?php
}
if(isset($_SESSION['id']) && $rFetch['author'] == $_SESSION['id'] or $team == 1){ ?><div id="forumAction"><a href="?p=forum&edit=<?php echo $rFetch['id']; ?>"><img src="img/edit.gif" /></a></div>
<?php
}
if($team == 1){
?>
<div id="forumAction"><a onclick="var c = confirm('Weet je het zeker?'); if(c == true) { delete_forumreaction(<?php echo $rFetch['id']; ?>); }"><img src="img/delete.gif" /></a></div>
<?php
}
?>
<br />
<?php
if($ruFetch['type'] == 4){
echo '<span style="color: red;">Deze gebruiker is verwijderd.</span><br />';
}
?>
<br />
<?php echo ubb(stripslashes($rFetch['message'])); ?>
<?php if($ruFetch['signature'] != '') { ?><br /><br />
<div style="height: 1px; width: 100%; background: #EEEEEE;"></div><br />
<?php echo ubb(stripslashes($ruFetch['signature'])); ?>
<?php
}
?>
</td>
</tr>
</table>
</div><br />
<?php
}
for($i = 1; $i <= $pages; $i++) {
if($i-1 == $p){
$style = 'border: 1px solid #99B837; background: #B0CD58; padding: 4px; color: #FFFFFF; font-weight: bold;';
}else{
$style = 'border: 1px solid #969696; background: #FFFFFF; padding: 4px; color: #969696;';
}
echo '<button style="' . $style . '" onclick="location.href = \'?p=forum&showtopic=' . mysql_real_escape_string($_GET['showtopic']) . '&page='.($i-1).'\';">'.$i.'</button> ';
}
echo '<br /><br />';
if(isset($_POST['submit'])){
if(strlen($_POST['message']) < 3){
echo '<div id="error">Je bericht is te kort!</div>';
}elseif($tFetch['type'] == 2 or $tFetch['type'] == 4){
echo '<div id="error">Je kan niet op dit topic reageren!</div>';
}elseif(!isset($_SESSION['id'])){
echo '<div id="error">Log in als je op een topic wilt reageren!</div>';
}else{
$message = htmlspecialchars($_POST['message']);
$message = nl2br($message);
mysql_query("INSERT INTO forumreactions VALUES (
NULL,
'" . mysql_real_escape_string($tFetch['id']) . "',
'" . mysql_real_escape_string($message) . "',
'" . $_SESSION['id'] . "',
1,
NOW()
);
") or die(mysql_error());
mysql_query("UPDATE topics SET last_reaction = NOW() WHERE id = '" . mysql_real_escape_string($tFetch['id']) . "'") or die(mysql_error());
?>
<a id="bottom">
</a>
<meta http-equiv="refresh" content="0;url=<?php echo '?p=forum&showtopic=' . $tFetch['id'] . '&page=' . $_POST['p']; ?>#bottom">
<?php
}
}else{
if($tFetch['type'] == 2){
echo '<div id="error"><img src="img/slotje.gif" /> Dit topic is gesloten, je kunt niet reageren.</div>';
}elseif(!isset($_SESSION['id'])){
echo '<div id="error">Log in als je op een topic wilt reageren!</div>';
}else{
?>
<a id="bottom"></a>
<table style="border: 0;">
<tr>
<td style="width: 250px;" valign="top">
<?php ubbbuttons('message'); ?>
</td>
<td valign="top">
<form method="post" action="?p=forum&showtopic=<?php echo $tFetch['id']; ?>#bottom">
<textarea style="width: 450px; height: 170px;" name="message" id="message"></textarea>
<input type="hidden" name="p" value="<?php echo $p; ?>" />
</td>
</tr>
</table>
<br /><br />
<input type="submit" value="Versturen" name="submit" />
</form>
<?php
}
}
}
}elseif(isset($_GET['maketopic']) && isset($_SESSION['id'])){
?>
<h1>Topic aanmaken</h1>
<?php
$lastPostQuery = mysql_query("SELECT * FROM topics WHERE NOT type = 4 ORDER BY id DESC LIMIT 1") or die(mysql_error());
$lastPostFetch = mysql_fetch_assoc($lastPostQuery);
if($lastPostFetch['author'] == $_SESSION['id']){
die('<div id="error">Je mag maar 1 topic na elkaar maken!</div>');
}
$cQuery = mysql_query("SELECT * FROM cats WHERE id = '" . mysql_real_escape_string($_GET['maketopic']) . "'");
$cFetch = mysql_fetch_assoc($cQuery);
if(mysql_num_rows($cQuery) == 0){
echo '<div id="error">Deze categorie bestaat niet</div>';
}elseif($cFetch['allowed'] == 0 and $team == 0){
echo '<div id="error">Je mag geen topics aanmaken in deze categorie!</div>';
}else{
if(isset($_POST['submit'])){
$message = htmlspecialchars($_POST['message']);
$message = nl2br($message);
if(strlen($message) < 3){
echo '<div id="error">Je bericht is te kort!</div>';
}elseif(strlen($_POST['title']) < 3){
echo '<div id="error">Je titel is te kort!</div>';
}else{
mysql_query("INSERT INTO topics VALUES (
NULL,
'" . mysql_real_escape_string(htmlspecialchars($_POST['title'])) . "',
'" . $_SESSION['id'] . "',
'" . mysql_real_escape_string($message) . "',
1,
NOW(),
'" . $cFetch['id'] . "',
NOW()
);
") or die(mysql_error());
$gQuery = mysql_query("SELECT * FROM topics WHERE author = '" . $_SESSION['id'] . "' ORDER BY id DESC LIMIT 1");
$gFetch = mysql_fetch_assoc($gQuery);
echo '<div id="succes">Het topic is aangemaakt! <a href="?p=forum&showtopic=' . $gFetch['id'] . '">Klik hier</a></div>';
}
}
?>
<table style="border: 0;">
<tr>
<td style="width: 120px;" valign="top">
UBB:
</td>
<td valign="top">
<?php
ubbbuttons('message');
?>
</td>
</tr>
<form method="post" action="?p=forum&maketopic=<?php echo $cFetch['id']; ?>">
<tr>
<td style="width: 120px;" valign="top">
Titel:
</td>
<td valign="top">
<input type="text" name="title" />
</td>
</tr>
<tr>
<td style="width: 120px;" valign="top">
Bericht:
</td>
<td valign="top">
<textarea name="message" id="message"></textarea>
</td>
</tr>
</table>
<br />
<input type="submit" value="Topic aanmaken" name="submit" />
</form>
<?php
}
}elseif(isset($_GET['cat'])){
$cQuery = mysql_query("SELECT * FROM cats WHERE id = '" . mysql_real_escape_string($_GET['cat']) . "'");
$cFetch = mysql_fetch_assoc($cQuery);
if(mysql_num_rows($cQuery) == 0){
echo '<div id="error">Deze categorie bestaat niet</div>';
}else{
$tQuery = mysql_query("SELECT * FROM topics WHERE catid = '" . mysql_real_escape_string($_GET['cat']) . "' AND NOT type = '4'") or die(mysql_error());
?>
<h1>Topics</h1>
<div style="border: 1px solid #CCCCCC; padding: 3px; width: 100%;">
<table style="border: 0; width: 100%;">
<tr>
<td></td>
<td>Titel</td>
<td>Door</td>
<td>Geplaatst op</td>
<td>Laatste reactie</td>
</tr>
<?php
while($tFetch = mysql_fetch_assoc($tQuery)){
$uQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($tFetch['author']) . "'") or die(mysql_error());
$uFetch = mysql_fetch_assoc($uQuery);
?>
<tr>
<td><img src="img/<?php if($tFetch['type'] == 1){ echo 'topic.png'; }elseif($tFetch['type'] == 2){ echo 'lock.gif'; }elseif($tFetch['type'] == 3){ echo 'sticky.png'; } ?>" /></td>
<td><a href="?p=forum&showtopic=<?php echo $tFetch['id']; ?>"><?php echo stripslashes($tFetch['title']); ?></a></td>
<td><a target="_blank" href="[URL="http://%3c/?php"]http://<?php[/URL] echo $uFetch['username']; ?>.Challas.nl/"><?php echo $uFetch['username']; ?></a></td>
<td><?php echo datenl($tFetch['date_posted']); ?></td>
<td><?php echo datenl($tFetch['last_reaction']); ?></td>
</tr>
<?php
}
?>
</table>
</div>
<?php
if(isset($_SESSION['id'])){
?>
<br />
<a href="?p=forum&maketopic=<?php echo $cFetch['id']; ?>">Maak een topic</a>
<?php
}
}
}elseif(isset($_GET['quote']) && isset($_SESSION['id'])){
echo '<h1>Quote</h1>';
$bQuery = mysql_query("SELECT * FROM forumreactions WHERE id = '" . mysql_real_escape_string($_GET['quote']) . "'") or die(mysql_error());
$bFetch = mysql_fetch_assoc($bQuery);
$tQuery = mysql_query("SELECT * FROM topics WHERE id = '" . mysql_real_escape_string($bFetch['topic_id']) . "'") or die(mysql_error());
$tFetch = mysql_fetch_assoc($tQuery);
if(mysql_num_rows($bQuery) == 0){
echo '<div id="error">Dit bericht bestaat niet!</div>';
}elseif($tFetch['type'] == 2 or $tFetch['type'] == 4){
echo '<div id="error">Je kunt niet reageren op dit topic.';
}else{
if(isset($_POST['submit'])){
$message = htmlspecialchars($_POST['quote']);
$message = nl2br($message);
mysql_query("INSERT INTO forumreactions VALUES (
NULL,
'" . mysql_real_escape_string($bFetch['topic_id']) . "',
'" . mysql_real_escape_string($message) . "',
'" . $_SESSION['id'] . "',
1,
NOW()
);
") or die(mysql_error());
mysql_query("UPDATE topics SET last_reaction = NOW() WHERE id = '" . mysql_real_escape_string($bFetch['topic_id']) . "'") or die(mysql_error());
echo '<div id="succes">Je bericht is geplaatst! <a href="?p=forum&showtopic=' . $bFetch['topic_id'] . '">Klik hier</a></div>';
}
$uQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($bFetch['author']) . "'") or die(mysql_error());
$uFetch = mysql_fetch_assoc($uQuery);
ubbbuttons('msg');
?>
<form method="post" action="?p=forum"e=<?php echo $bFetch['id']; ?>">
<textarea id="msg" name="quote" style="width: 500px; height: 200px;">
[quote]
<?php echo stripslashes(str_replace('<br />', '', $bFetch['message'])); ?>
[/quote]
Typ hier je bericht
</textarea>
<br /><br />
<input type="submit" name="submit" value="Versturen!" />
</form>
<?php
}
}elseif(isset($_GET['edit']) && isset($_SESSION['id'])){
$bQuery = mysql_query("SELECT * FROM forumreactions WHERE id = '" . mysql_real_escape_string($_GET['edit']) . "'") or die(mysql_error());
$bFetch = mysql_fetch_assoc($bQuery);
if($team == 0){
if($bFetch['author'] != $_SESSION['id']){
echo '<div id="error">Je mag dit bericht niet aanpassen.</div>';
die();
}
}
$uQuery = mysql_query("SELECT * FROM users WHERE id = '" . $_SESSION['id'] . "'") or die(mysql_error());
$uFetch = mysql_fetch_assoc($uQuery);
?>
<h1>Bericht veranderen</h1>
<?php
if(mysql_num_rows($bQuery) == 0){
echo '<div id="error">Dit bericht bestaat niet!</div>';
}else{
if(isset($_POST['submit'])){
$message = htmlspecialchars($_POST['edit']);
$message = nl2br($message);
mysql_query("UPDATE forumreactions SET message = '" . mysql_real_escape_string($message) . "<br /><br />[i]Laatst aangepast door " . $uFetch['username'] . " om " . date('Y-m-d H:i:s') . "[/i]' WHERE id = '" . mysql_real_escape_string($_GET['edit']) . "'") or die(mysql_error());
echo '<div id="succes">Het bericht is aangepast! <a href="?p=forum&showtopic=' .$bFetch['topic_id'] . '">Klik hier</a></div>';
}
ubbbuttons('edit');
?>
<form method="post" action="?p=forum&edit=<?php echo $_GET['edit']; ?>">
<textarea name="edit" id="edit" style="width: 500px; height: 200px;"><?php echo stripslashes(str_replace('<br />', '', $bFetch['message'])); ?></textarea><br />
<input type="submit" name="submit" value="Aanpassen" />
</form>
<?php
}
}elseif(isset($_GET['karma']) && isset($_SESSION['id'])){
$uQuery = mysql_query("SELECT * FROM users WHERE id = '" . mysql_real_escape_string($_GET['karma']) . "'") or die(mysql_error());
$uFetch = mysql_fetch_assoc($uQuery);
if(mysql_num_rows($uQuery) > 0){
if(isset($_SESSION['karma' . $uFetch['id']])){
echo 'Je kan niet 2x stemmen op dezelfde persoon!';
}elseif($uFetch['id'] == $_SESSION['id']){
echo 'Je kan niet op jezelf stemmen!';
}else{
mysql_query("UPDATE users SET karma = karma + 1 WHERE id = '" . mysql_real_escape_string($_GET['karma']) . "'") or die(mysql_error());
$_SESSION['karma' . $uFetch['id']] = true;
echo 'Karma gegeven!';
}
}else{
echo 'Gebruiker bestaat niet';
}
}else{
?>
<h1>Forum</h1>
<?php
$cQuery = mysql_query("SELECT * FROM cats");
while($cFetch = mysql_fetch_assoc($cQuery)){
?>
<div style="border: 1px solid #CCCCCC; padding: 3px; width: 100%;">
<a href="?p=forum&cat=<?php echo $cFetch['id']; ?>">
<span style="font-size: 15px;"><?php echo stripslashes($cFetch['title']); ?></span><br />
<?php echo stripslashes($cFetch['description']); ?>
</a>
</div>
<br />
<?php
}
}
?>
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic