Hallo, ik heb nog altijd een probleem met het forum bug , namelijk de F5 bug (100 topic's in zo veel tijd.)
Ik heb de de code wat mooi geplaats zo dat jullie er beter uit kunnen lezen.
Want ik moet toegeven, hoe het eerst was.. kon op deze momenten wel verdwalen in een bos !
Posting.php
PHP
<?
include("config.php");
session_start();
if($_GET['mode'] != delete
&& $_GET['mode'] != post
&& $_GET['mode'] != edit
&& $_GET['mode'] != reply
&& $_GET['mode'] != quote)
{ header("Location: $sitelink/index.php");
}
if($_GET['mode'] == delete)
{
if(isset($_GET['p']))
{
$deletep1 = mysql_query("SELECT * FROM `forumreplies` WHERE `id`='{$_GET['p']}'");
$deletep = mysql_fetch_object($deletep1);
if(
$deletep->auteur != $data->login
&& $data->admin == 0
&& $data->moderator == 0)
{
$error = deletefout;
$del3 = mysql_query("SELECT * FROM `forumreplies` WHERE `id`='{$_GET['p']}'");
$del2 = mysql_fetch_object($reply3);
$del1 = mysql_query("SELECT * FROM `forumtopics` WHERE `id`='$reply2->topic'");
}else{
mysql_query("DELETE FROM `forumreplies` WHERE `id`='{$_GET['p']}'");
$error = delete;
}
}
if(isset($_GET['t']))
{
$deletet1 = mysql_query("SELECT * FROM `forumtopics` WHERE `id`='{$_GET['t']}'");
$deletet = mysql_fetch_object($deletet1);
if(
$deletet->auteur != $data->login
&& $data->admin == 0
&& $data->moderator == 0)
{
$error = deletefout;
$del1 = mysql_query("SELECT * FROM `forumtopics` WHERE `id`='{$_GET['t']}'");
}else{
$error = delete;
mysql_query("DELETE FROM `forumtopics` WHERE `id`='{$_GET['t']}'");
mysql_query("DELETE FROM `forumreplies` WHERE `topic`='{$_GET['t']}'");
mysql_query("DELETE FROM `forumpolls` WHERE `topic`='{$_GET['t']}'");
}
}
$del = mysql_fetch_object($reply1);
}
if($_GET['mode'] == reply || $_GET['mode'] == quote || $_GET['mode'] == delete || $_GET['mode'] == edit)
{
if(isset($_GET['t']))
{
$reply1 = mysql_query("SELECT * FROM `forumtopics` WHERE `id`='{$_GET['t']}'");
}
if(isset($_GET['p']))
{
if($_GET['mode'] != edit)
{
$reply3 = mysql_query("SELECT * FROM `forumreplies` WHERE `id`='{$_GET['p']}'");
$reply2 = mysql_fetch_object($reply3);
$reply1 = mysql_query("SELECT * FROM `forumtopics` WHERE `id`='$reply2->topic'");
}else{
$reply1 = mysql_query("SELECT * FROM `forumreplies` WHERE `id`='{$_GET['p']}'");
}
}
$reply = mysql_fetch_object($reply1);
if($reply->auteur != $data->login
&& $data->admin < 1
&& $data->moderator < 1 && $_GET['mode'] == edit)
{
$error = deletefout;
}
}
if($reply->locked == 1){header("Location: $sitelink/v3/viewtopic.php?f={$_GET['f']}&t=$reply->id");
}
if(isset($_POST['post']))
{
if($_POST['message'] == "")
{
$error = 3;
}
if($_POST['subject'] == "")
{
$error = 4;
}
if($_POST['poll_title'] != ""
&& $_POST['poll_option_text1'] == "")
{
$error = 1;}
if($_POST['poll_option_text1'] != ""
&& $_POST['poll_option_text2'] == "")
{
$error = 1;}
if($_POST['poll_max_options'] > 10)
{
$_POST['poll_max_options'] = 10;
}
if($_POST['poll_max_options'] < 1)
{
$_POST['poll_max_options'] = 1;
}
if($error == "")
{
if(!isset($_POST['disable_smilies']))
{
$smilies = 1;
}else{
$smilies = 0;}
if(!isset($_POST['disable_bbcode']))
{
$bbcode = 1;
}else{
$bbcode = 0;
}
$geplaatst = (date("d-m-Y H:i"));
$gereplied = (date("d-m-Y"));
if($_GET['mode'] == post)
{
mysql_query("INSERT INTO `forumtopics`(title,content,auteur,smiles,ubb,subforum,date,lastreplydate,lastreply,lastreplydate2) values('{$_POST['subject']}','{$_POST['message']}','$data->login','$smilies','$bbcode','{$_GET['f']}','$geplaatst','$gereplied','$data->login',NOW())");
$select = mysql_query("SELECT * FROM `forumtopics` WHERE `title`='{$_POST['subject']}' AND `content`='{$_POST['message']}' ORDER BY `id` DESC");
while($sel = mysql_fetch_object($select))
{
if($stop == "")
{
$stop = 1;
$topicid = $sel->id;
}
}
$error = niks;
if($_GET['f'] == 8 && $data->admin == 1)
{
$news11 = mysql_query("SELECT * FROM `news` WHERE `place`='1'");
$news22 = mysql_query("SELECT * FROM `news` WHERE `place`='2'");
$news33 = mysql_query("SELECT * FROM `news` WHERE `place`='3'");
$news44 = mysql_query("SELECT * FROM `news` WHERE `place`='4'");
$news55 = mysql_query("SELECT * FROM `news` WHERE `place`='5'");
$news1 = mysql_fetch_object($news11);
$news2 = mysql_fetch_object($news22);
$news3 = mysql_fetch_object($news33);
$news4 = mysql_fetch_object($news44);
$news5 = mysql_fetch_object($news55);
$nieuws = (date("d-m"));
mysql_query("UPDATE `news` SET `author`='$news4->author',`title`='$news4->title',`date`='$news4->date',`id`='$news4->id' WHERE `place`='5'");
mysql_query("UPDATE `news` SET `author`='$news3->author',`title`='$news3->title',`date`='$news3->date',`id`='$news3->id' WHERE `place`='4'");
mysql_query("UPDATE `news` SET `author`='$news2->author',`title`='$news2->title',`date`='$news2->date',`id`='$news2->id' WHERE `place`='3'");
mysql_query("UPDATE `news` SET `author`='$news1->author',`title`='$news1->title',`date`='$news1->date',`id`='$news1->id' WHERE `place`='2'");
mysql_query("UPDATE `news` SET `author`='$data->login',`title`='{$_POST['subject']}',`date`='$nieuws',`id`='$topicid' WHERE `place`='1'");
}
if($_POST['poll_title'] != "")
{
mysql_query("INSERT INTO `forumpolls`(vraag,opties,geldig,optie1,optie2,optie3,optie4,optie5,optie6,optie7,optie8,optie9,optie10,topic) values('{$_POST['poll_title']}','{$_POST['poll_max_options']}','{$_POST['poll_length']}','{$_POST['poll_option_text1']}','{$_POST['poll_option_text2']}','{$_POST['poll_option_text3']}','{$_POST['poll_option_text4']}','{$_POST['poll_option_text5']}','{$_POST['poll_option_text6']}','{$_POST['poll_option_text7']}','{$_POST['poll_option_text8']}','{$_POST['poll_option_text9']}','{$_POST['poll_option_text10']}','$topicid')");
}
}
if($_GET['mode'] == edit)
{
if(isset($_GET['p']))
{
mysql_query("UPDATE `forumreplies` SET `content`='{$_POST['message']}',`title`='{$_POST['subject']}',`smiles`='$smilies',`ubb`='$bbcode' WHERE `id`='$reply->id'");
$error = niks;
}else if(isset($_GET['t']))
{
mysql_query("UPDATE `forumtopics` SET `content`='{$_POST['message']}',`title`='{$_POST['subject']}',`smiles`='$smilies',`ubb`='$bbcode' WHERE `id`='$reply->id'");
$error = niks;
}
}
if($_GET['mode'] == reply || $_GET['mode'] == quote){
mysql_query("INSERT INTO `forumreplies`(title,content,auteur,smiles,ubb,subforum,date,topic) values('{$_POST['subject']}','{$_POST['message']}','$data->login','$smilies','$bbcode','{$_GET['f']}','$geplaatst','$reply->id')");
mysql_query("UPDATE `forumtopics` SET `read`='0',`lastreplydate`='$gereplied',`lastreplydate2`=NOW(),`lastreply`='$data->login' WHERE `id`='$reply->id'");
$error = niks;
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="nl-nl" xml:lang="nl-nl">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="nl-nl" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2002-2006 phpBB Group" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<?
if($_GET['f'] == 6)
{
$text = "Vragen rondom het spel";
$categorietext = "Spel en ondersteuning";
$categorie = 10;
}
if($_GET['f'] == 12)
{
$text = "Plaats hier je secret links";
$categorietext = "Spel en ondersteuning";
$categorie = 10;
}
if($_GET['f'] == 5)
{
$text = "Fouten & Bugs";
$categorietext = "Spel en ondersteuning";
$categorie = 10;
}
if($_GET['f'] == 4)
{
$text = "Tips & Ideeën";
$categorietext = "Spel en ondersteuning";
$categorie = 10;
}
if($_GET['f'] == 8)
{
$text = "Nieuws en Updates";
$categorietext = "Spel en ondersteuning";
$categorie = 10;
}
if($_GET['f'] == 3)
{
$text = "Algemeen Forum";
$categorietext = "Forums";
$categorie = 9;
}
if($_GET['f'] == 7)
{
$text = "Het café";
$categorietext = "Forums";
$categorie = 9;
}
if($error != niks
&& $error != delete
&& $error != deletefout)
{
?>
<title>Banditi • Plaats <? if($_GET['mode'] == post){?>een nieuw bericht<? }if($_GET['mode'] == reply || $_GET['mode'] == quote){?>reactie<? } ?></title>
<?
}else{
?>
<meta http-equiv="refresh" content="1;url=<? echo$sitelink;?>/v3/viewtopic.php?f=<? echo$_GET['f'];?>&t=<? if($_GET['mode'] == post){echo$topicid;}if($_GET['mode'] == reply || $_GET['mode'] == quote || $_GET['mode'] == delete){echo$reply->id;}?>" /><title>Chocogamerz • Informatie</title>
<?
}
?>
<link rel="stylesheet" href="./styles/ubuntu/theme/stylesheet.css" type="text/css" />
<link rel="stylesheet" href="./css/style.css" type="text/css" />
<script type="text/javascript" src="./js/prototype-1.6.0.2.js"></script>
</head>
<?
mysql_query("UPDATE `users` SET `online`=NOW() WHERE `login`='{$data->login}'");
if($_GET['x'] == delsafemode)
{
mysql_query("UPDATE `users` SET `safe`='0' WHERE `login`='$data->login'");
}
?>
<script language="javascript">
// <![CDATA[
function popup(url, width, height, name)
{
if (!name)
{
name = '_popup';
}
window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes,width=' + width);
return false;
}
function jumpto()
{
<?
$dbres = mysql_query("SELECT * FROM `forumtopics`");
$num = mysql_num_rows($dbres);
$pages = floor($num/25)+1;
?>
var page = prompt('Geef het paginanummer van de pagina waarnaar je wilt gaan:', '');
var perpage = '25';
var maxpages = '<?echo$pages;?>';
var base_url = '<?=$sitelink?>/v3/';
if (page !== null && !isNaN(page) && page > 0 && page <= maxpages)
{
document.location.href = base_url.replace(/&/g, '&') + '<? echo"viewforum.php?f={$_GET['f']}&st={$_GET['st']}&sk=$sk&sd=$sd&"?>&start=' + ((page - 1) * perpage);
}
}
/**
* Find a member
*/
function find_username()
{
popup(url, 760, 570, '_usersearch');
return false;
}
/**
* Mark/unmark checklist
* id = ID of parent container, name = name prefix, state = state [true/false]
*/
function marklist(id, name, state)
{
var parent = document.getElementById(id);
if (!parent)
{
eval('parent = document.' + id);
}
if (!parent)
{
return;
}
var rb = parent.getElementsByTagName('input');
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
{
rb[r].checked = state;
}
}
}
// ]]>
</script>
Toon Meer