...

View Full Version : forum system from php using iframes



Dan13071992
12-15-2011, 01:13 PM
I have both the java script and the php files, i just need to intergrate them into eachother to display the different topics and forums:

New Forum:

index.php :



<?php
include('../includes/db_connect.php');
include('../includes/inc-logincheck.php');
include('../includes/inc-functions.php');
include('../includes/inc-userfunctions.php');
include('../includes/inc-menu.php');
//include('../includes/smile.php');
$strTitle='Forum';
$strMessage='';
$intUserID=$_SESSION['uID'];
$fetch=$user;
////include('../includes/forumhead.php');


$forum=$_GET['forum'];
$viewtopic = $_GET['viewtopic'];

if ($crew == "0"){
$query="SELECT * FROM `topics` WHERE `forum`='$forum'";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
$col="0";
while($fo=mysql_fetch_object($query)){
if ($col=="0"){ $td="#444444"; $col="1"; }else{ $td="#555555"; $col="0"; }

$hehe=mysql_num_rows(mysql_query("SELECT * FROM replys WHERE idto='$fo->id'"));
}
?>
<link rel="stylesheet" type="text/css" href="../includes/forum.css">
<td width="99%" background="../game/site/site/innerbg.gif" bgcolor="#222222" valign="top">

<br>

<center>
<table border="0" cellspacing="0" cellpadding="10" width="100%" class="cat">
<tr>
<td>
<script language='JavaScript' type='text/javascript' src='../includes/scripts/autosize.js'></script>
<script>
var box = 'reply';
var oldTopic = 5;
var muted = 'no';
var set = 0;

function parseUrl(url,variable){

var theurl = url.split('?');

if(theurl[1]){

pars = theurl[1].split('&');

for(i = 0; i < pars.length; i++){

var check = pars[i].split('=');

if(check[0] == variable){

return check[1];

}

}

}

return false;

}

function keepRefreshed(){

if(set == 0){

refresher = setTimeout("keepRefreshed()", 60000);
allowButton = setTimeout("allowRefresh()", 3000);
set = 1;

} else {

refreshTopics();

}

}

function allowRefresh(){

document.replyForm.refreshButton.disabled = false;

}

function refreshTopics(hl){

if(set == 1){

clearTimeout(refresher);
clearTimeout(allowButton);

}

document.replyForm.refreshButton.disabled = true;

refresher = setTimeout("keepRefreshed()", 60000);
allowButton = setTimeout("allowRefresh()", 3000);

if(document.replyForm.editIt.value == 'x'){

currentTopics = self.frames['topicsFrame'].location.href;

var page = parseUrl(currentTopics, 'page');
var forum = parseUrl(currentTopics, 'forum');
var flag = parseUrl(currentTopics, 'flag');

if(flag){

add = '&flag=' + flag;

} else {

add = '';

}

if(!page){

page = 1;

}

if(!forum){

forum = 1;

}

if(!hl){

hl = oldTopic;

}

self.frames['topicsFrame'].location.href = 'topics.php?forum=' + forum + '&default=' + oldTopic + '&page=' + page + '&hl=' + hl + add;


}

}

function updateBox(id){

oldTopic = id;

if(document.replyForm.editIt.value != 'x'){

document.replyForm.editIt.value = 'x';
document.replyForm.topicSubject.disabled = false;
document.replyForm.selectedFlag.disabled = false;
document.replyForm.submitTitle.value = 'Add!';

switchBox(true);

} else {

if(box == 'reply'){

document.replyForm.replyTo.value = id;
document.replyForm.action = 'view.php?id=' + id + '&forum=' + 1;

}

}

}

function emotion(em){

document.replyForm.replyMes.value = document.replyForm.replyMes.value + em;

document.replyForm.replyMes.scrollTop = document.replyForm.replyMes.scrollHeight;

}

function editThread(id, flag, points){

mes = self.frames['repliesFrame'].document.getElementById('topicMessage').value;
sub = self.frames['repliesFrame'].document.getElementById('topicSubject').innerHTML;

var replyform = document.replyForm;

if(box == 'reply'){

switchBox();

}

document.getElementById('topHeader').innerHTML = 'Edit thread';
replyform.topicSubject.value = sub;
replyform.topicSubject.disabled = true;
replyform.replyMes.value = mes;
replyform.replyMes.focus();
replyform.editIt.value = id;
replyform.selectedFlag.value = flag;
replyform.selectedFlag.disabled = true;
checkPoints();
replyform.addPoints.value = points;
replyform.submitTitle.value = 'Edit!';


}

function addQuote(type, username, id){

if(type == 'topic'){

quote = self.frames['repliesFrame'].document.getElementById('topicMessage');

} else {

quote = self.frames['repliesFrame'].document.getElementById('quote_' + id);

}

format = '
' + quote.innerHTML + '\n\n';

document.replyForm.replyMes.value = document.replyForm.replyMes.value + format;

document.replyForm.replyMes.scrollTop = 0;
document.replyForm.replyMes.scrollTop = document.replyForm.replyMes.scrollHeight;

}

function switchBox(c,k){

if(document.replyForm.editIt.value != 'x'){

updateBox(oldTopic);
return;

}

if((box == 'reply') && (!k)){

document.replyForm.action = 'topics.php?forum=1';
document.replyForm.target = 'topicsFrame';
document.replyForm.replyTo.value = 'x';
document.getElementById('topHeader').innerHTML = 'New topic';
document.getElementById('title').innerHTML = 'Add reply';
document.getElementById('topicTitle').style.display = 'block';

if(1 == 1){

document.getElementById('flagBox').style.display = 'block';

}

box = 'topic';

} else {

if(c){

document.replyForm.topicSubject.value = '';
document.replyForm.replyMes.value = '';
document.replyForm.addPoints.value = '';
document.replyForm.selectedFlag.value = 1;

if(k){

url = 'topics.php?forum=1&hl=' + k;

if(1 == 1){

if(document.replyForm.forumFilter.value){

url = url + '&flag=' + document.replyForm.forumFilter.value;

}

}

self.frames['topicsFrame'].location.href = url;

}

}

document.replyForm.action = 'view.php?id=' + oldTopic + '&forum=' + 1;
document.replyForm.target = 'repliesFrame';
document.replyForm.replyTo.value = oldTopic;
document.getElementById('topHeader').innerHTML = 'Add reply';
document.getElementById('title').innerHTML = 'Add topic';
document.getElementById('topicTitle').style.display = 'none';
document.getElementById('flagBox').style.display = 'none';
document.getElementById('addPoints').style.display = 'none';
box = 'reply';

}

if(box == 'reply'){

updateButton(false);

} else {

checkPoints();
updateButton(true);

}

}

function displayError(message){

if(message == 'clear'){

switchBox(true);

document.getElementById('forumError').style.display = 'none';
document.getElementById('forumError').innerHTML = '';

} else {

document.getElementById('forumError').style.display = 'block';
document.getElementById('forumError').innerHTML = message;

}

}

var timel = 0;

function countdown(){

timel -= 1;

if(timel <= 0){

unMute();

} else {

minutes = Math.floor(timel / 60);

seconds = timel - (minutes * 60);

document.getElementById('timeleft').innerHTML = '<b>Time left:</b> ' + minutes + ' minutes ' + seconds + ' seconds';

setTimeout("countdown()", 1000);

}

}

function mutePlayer(muter, reason, post, timeleft){

muted = 'yes';
timel = timeleft;

minutes = Math.floor(timeleft / 60);

seconds = timeleft - (minutes * 60);

document.getElementById('muteBox').innerHTML = 'You are unable to post because you have been muted by: <a href="viewprofile.php?viewuser=' + muter + '">' + muter + '</a><br><br><b>Reason:</b> ' + reason + '<br><div id="timeleft"><b>Time left:</b> ' + minutes + ' minutes ' + seconds + ' seconds</div><b>Post:</b><br>' + post;
document.getElementById('replyBox').style.display = 'none';
document.getElementById('muteBox').style.display = 'block';

setTimeout("countdown()", 1000);

}

function unMute(){

muted = 'no';
document.getElementById('replyBox').style.display = 'block';
document.getElementById('muteBox').style.display = 'none';

}

function checkPoints(){

var flag = document.replyForm.selectedFlag;

if(flag.value == 13){

document.getElementById('addPoints').style.display = 'block';

} else {

document.getElementById('addPoints').style.display = 'none';

}

if(flag.value <= 3){

updateButton(true);

} else {

updateButton(false);

}

}

function updateButton(upto){

if(1 == 1){

var button = document.replyForm.submitTitle;
var flag = document.replyForm.selectedFlag;

if((upto) && (flag.value <= 3)){

button.disabled = true;

} else {

button.disabled = false;

}

}

}

function updateFilter(){

var flag = document.replyForm.forumFilter.value;

if(flag != 'void'){

url = 'topics.php?forum=1';

if(flag != 'all'){

url += '&flag=' + flag;

}

self.frames['topicsFrame'].location.href = url;

}

}

function watchThread(){

url = 'topics.php?forum=1&hl=' + oldTopic + '&watch=' + oldTopic;

if(document.replyForm.forumFilter.value){

url = url + '&flag=' + document.replyForm.forumFilter.value;

}

self.frames['topicsFrame'].location.href = url;

}

</script>

<div id="forumError" display="none"></div>


<center>
<table border=0 cellspacing=0 cellpadding=2 width=99% bordercolor=black>
<tr>
<td width=40% valign=top class="insideTables">

<form name="replyForm" method="post" target="repliesFrame" action="view.php?id=5&forum=1">
<table border=1 cellspacing=0 cellpadding=2 width=100% class=sub2 bordercolor=black>
<tr>
<td align=center class=header><div id="topHeader">Add reply</div></td>

</tr>
<tr>
<td>
<div id="replyBox">

<div style="display:none;" id="topicTitle">Subject: <input type=text style="width:100%" name="topicSubject" maxlength=35><br>Message:<br></div>

<textarea style="width:100%" rows=5 name="replyMes" style="white-space: normal;"></textarea>

<div style="display:none;" id="flagBox">


<select style="width:100%;" name="selectedFlag" onChange="javascript:checkPoints()"><option selected value="1" style="background-color:#CDCDCD;">--- GAME RELATED ---</option>
<option value="4" style="background-color:#69A16C;">Questions/Help</option>
<option value="5" style="background-color:#69A16C;">Feature Discussion</option>
<option value="6" style="background-color:#69A16C;">RIP/WS</option>
<option value="7" style="background-color:#69A16C;">Bust Party</option>
<option value="8" style="background-color:#69A16C;">Promotions</option>
<option value="22" style="background-color:#69A16C;">Other</option>
<option value="2" style="background-color:#CDCDCD;">--- OFF TOPIC ---</option>

<option value="9" style="background-color:#CCAB6B;">Contests & Games</option>
<option value="10" style="background-color:#CCAB6B;">Bars</option>
<option value="11" style="background-color:#CCAB6B;">Rate THIS</option>
<option value="21" style="background-color:#CCAB6B;">Sports</option>
<option value="23" style="background-color:#CCAB6B;">Movies, Music & TV</option>
<option value="24" style="background-color:#CCAB6B;">Other</option>
<option value="3" style="background-color:#CDCDCD;">--- CLASSIFIEDS ---</option>
<option value="13" style="background-color:#6B9FCC;">Points</option>

<option value="14" style="background-color:#6B9FCC;">Crew</option>
<option value="15" style="background-color:#6B9FCC;">Pictures & Music</option>
<option value="16" style="background-color:#6B9FCC;">Casino</option>
<option value="17" style="background-color:#6B9FCC;">Protection</option>
<option value="18" style="background-color:#6B9FCC;">Organized Crime</option>
<option value="19" style="background-color:#6B9FCC;">Establishment</option>
<option value="20" style="background-color:#6B9FCC;">Other</option>
</select>

</div>


<div style="display:none;" id="addPoints">

Verify: <input type=text name="addPoints" size=5>

</div>

<br>


<input type=hidden name="replyTo">
<input type=hidden name="editIt" value="x">

<center>
<a onclick="emotion(' :arrow: ')" style="cursor: pointer;"><img src="../game/emotions/arrow.gif" border=0 alt=":arrow:"></a>

<a onclick="emotion(' :D ')" style="cursor: pointer;"><img src="../game/emotions/biggrin.gif" border=0 alt=":D"></a>
<a onclick="emotion(' :S ')" style="cursor: pointer;"><img src="../game/emotions/confused.gif" border=0 alt=":S"></a>
<a onclick="emotion(' 8) ')" style="cursor: pointer;"><img src="../game/emotions/cool.gif" border=0 alt="8)"></a>
<a onclick="emotion(' :\'( ')" style="cursor: pointer;"><img src="../game/emotions/cry.gif" border=0 alt=":'("></a>
<a onclick="emotion(' 8| ')" style="cursor: pointer;"><img src="../game/emotions/eek.gif" border=0 alt="8|"></a>
<a onclick="emotion(' :evil: ')" style="cursor: pointer;"><img src="../game/emotions/evil.gif" border=0 alt=":evil:"></a>
<a onclick="emotion(' :!: ')" style="cursor: pointer;"><img src="../game/emotions/exclaim.gif" border=0 alt=":!:"></a>
<a onclick="emotion(' :idea: ')" style="cursor: pointer;"><img src="../game/emotions/idea.gif" border=0 alt=":idea:"></a>
<a onclick="emotion(' :lol: ')" style="cursor: pointer;"><img src="../game/emotions/lol.gif" border=0 alt=":lol:"></a>

<a onclick="emotion(' :mad: ')" style="cursor: pointer;"><img src="../game/emotions/mad.gif" border=0 alt=":mad:"></a>
<br>
<a onclick="emotion(' :?: ')" style="cursor: pointer;"><img src="../game/emotions/question.gif" border=0 alt=":?:"></a>
<a onclick="emotion(' :redface: ')" style="cursor: pointer;"><img src="../game/emotions/redface.gif" border=0 alt=":redface:"></a>
<a onclick="emotion(' :rolleyes: ')" style="cursor: pointer;"><img src="../game/emotions/rolleyes.gif" border=0 alt=":rolleyes:"></a>
<a onclick="emotion(' :( ')" style="cursor: pointer;"><img src="../game/emotions/sad.gif" border=0 alt=":("></a>
<a onclick="emotion(' :) ')" style="cursor: pointer;"><img src="../game/emotions/smile.gif" border=0 alt=":)"></a>
<a onclick="emotion(' :o ')" style="cursor: pointer;"><img src="../game/emotions/surprised.gif" border=0 alt=":o"></a>
<a onclick="emotion(' :P ')" style="cursor: pointer;"><img src="../game/emotions/toungue.gif" border=0 alt=":P"></a>

<a onclick="emotion(' :twisted: ')" style="cursor: pointer;"><img src="../game/emotions/twisted.gif" border=0 alt=":twisted:"></a>
<a onclick="emotion(' ;) ')" style="cursor: pointer;"><img src="../game/emotions/wink.gif" border=0 alt=";)"></a>
<a onclick="emotion(' :tdn: ')" style="cursor: pointer;"><img src="../game/emotions/tdown.gif" border=0 alt=":tdn:"></a>
<a onclick="emotion(' :tup: ')" style="cursor: pointer;"><img src="../game/emotions/tup.gif" border=0 alt=":tup:"></a>
<br>
<input type=submit value="Add!" name="submitTitle"> <input type=button value="Watch!" onClick="javascript:watchThread()"> <input type=button value="Refresh!" name="refreshButton" onClick="javascript:refreshTopics()">
</center>

</div>

<div id="muteBox" style="display:none;"></div>

</td>
</tr>
<tr>
<td align=center class=header>Topics (<a href="javascript:switchBox()" id="title">Add topic</a>)</td>
</tr>
<tr>

<td>
<select style="width:100%;" onChange="javascript:updateFilter()" name="forumFilter">
<option value="void" style="background-color:#CDCDCD;"> FILTER</option>
<option value="all">View all</option>
<option selected value="1" style="background-color:#CDCDCD;">--- GAME RELATED ---</option>
<option value="4" style="background-color:#69A16C;">Questions/Help</option>
<option value="5" style="background-color:#69A16C;">Feature Discussion</option>

<option value="6" style="background-color:#69A16C;">RIP/WS</option>
<option value="7" style="background-color:#69A16C;">Bust Party</option>
<option value="8" style="background-color:#69A16C;">Promotions</option>
<option value="22" style="background-color:#69A16C;">Other</option>
<option value="2" style="background-color:#CDCDCD;">--- OFF TOPIC ---</option>
<option value="9" style="background-color:#CCAB6B;">Contests & Games</option>
<option value="10" style="background-color:#CCAB6B;">Bars</option>
<option value="11" style="background-color:#CCAB6B;">Rate THIS</option>

<option value="21" style="background-color:#CCAB6B;">Sports</option>
<option value="23" style="background-color:#CCAB6B;">Movies, Music & TV</option>
<option value="24" style="background-color:#CCAB6B;">Other</option>
<option value="3" style="background-color:#CDCDCD;">--- CLASSIFIEDS ---</option>
<option value="13" style="background-color:#6B9FCC;">Points</option>
<option value="14" style="background-color:#6B9FCC;">Crew</option>
<option value="15" style="background-color:#6B9FCC;">Pictures & Music</option>
<option value="16" style="background-color:#6B9FCC;">Casino</option>

<option value="17" style="background-color:#6B9FCC;">Protection</option>
<option value="18" style="background-color:#6B9FCC;">Organized Crime</option>
<option value="19" style="background-color:#6B9FCC;">Establishment</option>
<option value="20" style="background-color:#6B9FCC;">Other</option>
</select>
</td>
</tr>
<tr>
<td>

<iframe width=100% height="357" src="topics.php?forum=1&flag=<?php echo "$forum"; ?>" frameborder="0" allowTransparency="true" name="topicsFrame" id="topicsFrame"></iframe>
</td>
</tr>
</table>
</form>

</td>
<td width=60% valign=top>

<iframe width=100% height="590" src="view.php?forum=1&id=<?php echo "$viewtopic"; ?>" frameborder="0" id="repliesFrame" name="repliesFrame" allowTransparency="true"></iframe>


</td>
</tr>
</table>


</td>
</tr>
</table>

</td>

<?php

include("/home/tacticsc/domains/360-tactics.co.uk/public_html/crimewave/includes/inc-footer.php"); ?>


i will post the rest of the codes in comments below due to too many word count.

if its not to hard please help me, i have put all the Javascript there and the php it just needs to be implimented, i have started some of it, such as getting the topics to display like so:

http://crimewave.360-tactics.co.uk/forum.gif

its just when you click the topic it doesnt load into the right hand iframe and some other things like the reply box ect

thanks.

Dan

Dan13071992
12-15-2011, 01:13 PM
topics.php:



<?php
include('../includes/db_connect.php');
include('../includes/inc-logincheck.php');
include('../includes/inc-functions.php');
include('../includes/inc-userfunctions.php');

include('../includes/smile.php');
$strTitle='Topics';
$strMessage='';
$intUserID=$_SESSION['uID'];
$fetch=$user;

////include('../includes/forumhead.php');

$fetch2=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$fetch->username'"));
$accesslevel=$fetch2->accesslevel;



?>

<script>
var selected = 0;

if(parent.set == 0){

window.onload = parent.keepRefreshed;

}

function topicHightlight(id){

topic = document.getElementById('topicId' + id);

if(topic){

topic.style.backgroundColor='#5A4747';
document.body.style.cursor='pointer';

}

}

function topicSelect(id,ignore){

topic = document.getElementById('topicId' + id);

if(topic){

previous = selected;
selected = id;

if(previous != 0){

topicReturn(previous);

}

if(!ignore){

parent.frames['repliesFrame'].location.href = 'view.php?forum=1&id=' + id;

}

parent.updateBox(id);

}

}

function topicReturn(id){

if(id != selected){

document.getElementById('topicId' + id).style.backgroundColor='';

}

}


</script>
<script>

setTimeout("topicSelect('5', true)",100);
setTimeout("topicHightlight('5')",100);

</script>

<link rel="stylesheet" type="text/css" href="../includes/forum.css">
<center>
<form method=get action=/forum_new/topics.php>
<table border=0 cellspacing=0 cellpadding=0 width=100% bordercolor=black class=sub2>

<?php

if ($forum == "Crew" && $fetch2->crew != "0"){
$crew="1";

}
$owner=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$fetch->username' OR rhm='$fetch->username'"));

if ($crew == "1"){
$query="SELECT * FROM `topics` WHERE `forum`='Game' AND crew='$fetch2->crew' ORDER BY `lastreply`";
}else{
$query="SELECT * FROM `topics` WHERE `forum`='Game' ORDER BY `lastreply` AND `sticky`!='0'";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
$col="0";
while($fo=mysql_fetch_object($query)){
if ($col=="0"){ $td="#444444"; $col="1"; }else{ $td="#555555"; $col="0"; }

$hehe=mysql_num_rows(mysql_query("SELECT * FROM replys WHERE idto='$fo->id'"));




echo " <tr>
<td>

<table border=0 cellspacing=0 cellpadding=2 bordercolor=0 class=sub2 width=100% id='topicId$fo->id' onMouseOver='javascript:topicHightlight($fo->id)' onMouseOut='javascript:topicReturn($fo->id)'>
<tr>
<td onMouseDown='javascript:topicSelect($fo->id)' width=95%>$fo->title</td>
<td width=5% align=right>$hehe</td>
</tr>

</table>

</td>
</tr>";
}

?>
</table>

<br>

<table border=0 cellspacing=0 cellpadding=2 width=75% class=sub>
<tr>
<td width=50% align=left>&nbsp;</td>
<td width=50% align=right><a href="topics.php?forum=1&page=2&flag=1">Next</a></td>
</tr>

</table>
</form></center>

Dan13071992
12-15-2011, 01:14 PM
view.php:



<?php
include('../includes/db_connect.php');
include('../includes/inc-logincheck.php');
include('../includes/inc-functions.php');
include('../includes/inc-userfunctions.php');

include('../includes/smile.php');
$strTitle='View Topic';
$strMessage='';
$intUserID=$_SESSION['uID'];
$fetch=$user;
$viewtopic = $_GET['id'];

/////include('../includes/forumhead.php');

?>

<script>

var Img = new Image();
var maxWidth = parent.document.getElementById('repliesFrame').clientWidth;
maxWidth -= 30;

function autoResize(){

images = document.getElementsByTagName('img');

for(i = 0; i < images.length; i++){

if(images[i].id != 'ignore'){

Img.src = images[i].src

if(Img.width > maxWidth){

images[i].width = maxWidth;

images[i].onclick = openImg;

images[i].onmouseover = pointerOn;

images[i].onmouseout = pointerOff;

}

}

}

}

function openImg(){

window.open(this.src);

}

function pointerOn(){

document.body.style.cursor='pointer';

}

function pointerOff(){

document.body.style.cursor='';

}

function verifyId(){

autoResize();

var checkId = <?php echo "$dsdsd->id"; ?>;

if(checkId != parent.oldTopic){

parent.frames['topicsFrame'].topicHightlight(checkId);
parent.frames['topicsFrame'].topicSelect(checkId, true);

}

}

window.onload = verifyId;
</script>

<link rel="stylesheet" type="text/css" href="../includes/forum.css">
<center>
<span class="insideTables">
<table border=1 cellspacing=0 cellpadding=2 width=100% bordercolor=black class=sub2>
<?php
if ($forum == "Crew" && $fetch2->crew != "0"){
$crew="1";

}
$owner=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$fetch->username' OR rhm='$fetch->username'"));


$accesslevel=$fetch2->accesslevel;





$ggee = mysql_query("SELECT locked, sticky, lastreply FROM topics WHERE id='$viewtopic' AND forum='$forum'");
while($dsdsd = mysql_fetch_row($ggee)){
$lockedornot = $dsdsd[0];
$stikornot = $dsdsd[1];
$lastreplyit = $dsdsd[2];
}



if ($crew == "1"){
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum' AND crew='$fetch2->crew'");
}else{
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum'");
}
while($success = mysql_fetch_row($gg)){
$fetch3->username = $success[1];
$topictext = $success[3];
$made = $success[8];
$cat = $success[10];

}
echo "
<tr>
<td class=header><span class=noBorder>
<table border=0 cellspacing=0 cellpadding=0 width=100% style='border:0px;'>
<tr>
<td style='font-size: 13px; font-family: verdana;color: white;'><b>$made</b> - <a href='/profile.php?user=$fetch3->username' target='_parent'>$stateaccesslevel</a> (<a href='javascript:parent.addQuote('topic', '$stateaccesslevel')' title='Quote'><font color=black>Q</font></a>) </td>

<td align=right>

<table border=1 cellspacing=0 cellpadding=0 bordercolor=black class=sub>
<tr>
<td bgcolor='#69A16C'>Other</td>
</tr>
</table>

</td>
</tr>
</table></span></td>

</tr>
<tr>
<td>
".replace($topictext)."
<div id='topicSubject' style='display:none;'>$made</div>
</td>

</tr>
</table>";

?>











<textarea id="topicMessage" style="display:none;">
</textarea>

<br></span>

<table border=0 cellspacing=0 cellpadding=2 width=75% class=sub>
<tr>
<td colspan=3 align=center>Page</td>

</tr>
<tr>
<td align=left width=10% valign=top>&nbsp;
</td>
<td align=center width=80%>
</td>
<td align=right width=10% valign=top>&nbsp;
</td>
</tr>
</table>

</center>

Dan13071992
12-15-2011, 01:14 PM
Old Forum:

forum.php:



<?php
include('includes/db_connect.php');
include('includes/inc-logincheck.php');
include('includes/inc-functions.php');
include('includes/inc-userfunctions.php');
include('includes/inc-menu.php');
include('includes/smile.php');
$strTitle='Forum';
$strMessage='';
$intUserID=$_SESSION['uID'];
$fetch=$user;
include('includes/inc-head.php');
?>
<td background="game/site/site/innerbg.gif" bgcolor="#222222" valign="top" width="99%">

<br>

<center>
<?php if ($_POST){ ?> <?php echo "<font color=white><b><center>$message</center><b><br>"; ?> <? } ?>
<?php
$fetch2=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$fetch->username'"));
$accesslevel=$fetch2->accesslevel;
if ($fetch2->mute == "1"){

echo "You Have Been Muted From Using The Forums.";
die();
}

$forum=$_GET['forum'];

if ($forum == "Crew" && $fetch2->crew != "0"){
$crew="1";

}
$owner=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$fetch->username' OR rhm='$fetch->username'"));




$forum_look=$_GET['forum_look'];
echo "<link rel=stylesheet href=includes/in.css type=text/css>";





$forum_count = 30;

function index_navigation($index, $count, $num) {
$forum = $_GET['forum'];
if ($index != 0) {
print "<a href=\"forum.php?forum=".$forum."&forum_look=" . ($index - $count) . "\">Previous</a> ";
}
if ($num == $count) {
print " <a href=\"forum.php?forum=".$forum."&forum_look=" . ($index + $count) . "\">Next</a>";
}


}
if (! isset($forum_look) ) {
$forum_look = 0;
}
?>
<table border="1" cellspacing="0" cellpadding="2" class=thinline width="650" bordercolor=black bgcolor="#808080" style="border-collapse: collapse">
<tr><td background="includes/grad.jpg" colspan="5"><center>
<strong><?php echo "$forum" ?> Forum</strong>
</center></td></tr>



<?php
if ($crew == "1"){
$query="SELECT * FROM `topics` WHERE `forum`='$forum' AND crew='$fetch2->crew' ORDER BY `lastreply` DESC LIMIT $forum_look, $forum_count";
}else{
$query="SELECT * FROM `topics` WHERE `forum`='$forum' ORDER BY `lastreply` AND `sticky`!='0' DESC LIMIT $forum_look, $forum_count";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
$col="0";
while($fo=mysql_fetch_object($query)){
if ($col=="0"){ $td="#444444"; $col="1"; }else{ $td="#555555"; $col="0"; }

$hehe=mysql_num_rows(mysql_query("SELECT * FROM replys WHERE idto='$fo->id'"));






if ($fetch2->accesslevel >= 1 || strtolower($by) == strtolower($fetch->username) || $crew == "1" && $owner != "0"){
echo "<tr bgcolor=$td><td width='92%'>"; if ($fo->sticky == "1" ){ echo"<img align='left' src='images/sticky.gif' border='0'>"; }
if ($fo->locked == "1" ){ echo"<img align='left' src='images/locked.gif' border='0'>"; }

if ($fo->sticky == "1" ) {
echo "<a href='forumview.php?viewtopic=$fo->id&forum=$forum' target='_self'><b>$fo->title</b></a> </td><td>"; }
elseif ($fo->sticky == "1" && $fo->locked == "1") {
echo "<img align='left' src='images/sticky.gif' border='0'>"; }
elseif ($fo->sticky == "0" ) {
echo "<a href='forumview.php?viewtopic=$fo->id&forum=$forum' target='_self'>$fo->title</a> </td><td>"; }
if ($fo->locked == "1" ) {
echo "<a title='Unlock' href='forum.php?unlock=$fo->id&forum=$forum'><img align='left' src='images/locked.gif' border='0'></a>"; } elseif($fo->locked == "0" ) {
echo "<a title='Lock' href='forum.php?lock=$fo->id&forum=$forum'><img align='left' src='images/locked.gif' border='0'></a>"; }






if ($fo->sticky == "1" ) {
echo "</td><td><a title='Unsticky' href='forum.php?unstick=$fo->id&forum=$forum'><img align='left' src='images/sticky.gif' border='0'></a>"; }
elseif ($fo->sticky == "0") {
echo "</td><td><a title='Sticky' href='forum.php?stick=$fo->id&forum=$forum'><img align='left' src='images/sticky.gif' border='0'></a>"; }
echo "</td><td><a title='Delete' href='forum.php?clean=$fo->id&forum=$forum'><font color=red>[D]</font></a></td>";
}else{
echo "<tr bgcolor=$td><td width='92%'>"; if ($fo->sticky == "1" ){ echo"<img align='left' src='images/sticky.gif' border='0'>"; }
if ($fo->locked == "1" ){ echo"<img align='left' src='images/locked.gif' border='0'>"; }

if ($fo->sticky == "1" ){
echo "<a href='forumview.php?viewtopic=$fo->id&forum=$forum' target='_self'><b>$fo->title</b></a></td>"; }
elseif ($fo->sticky == "0" ){
echo "<a href='forumview.php?viewtopic=$fo->id&forum=$forum' target='_self'>$fo->title</a></td>"; }
}


echo "<td width='8%' align='right'>$hehe</td></tr>";




}






if($_GET[lock]) {
$lock = $_GET[lock];
if($fetch2->accesslevel == "0") { die('You cannot lock this topic'); }
$locked =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$fetch->username' AND id='$lock'"));

$check1=mysql_query("SELECT * FROM topics WHERE id='$lock'");

$chech=mysql_fetch_object($check1);


if($accesslevel > 0 || $lock != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET locked='1' WHERE id='$lock' AND crew = '$fetch2->crew' ");

}else{
mysql_query("UPDATE topics SET locked='1' WHERE id='$lock'");

}

$message= "Locked";
$message= "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=forum.php?forum=$forum'>";
}
}
if($_GET[unlock]) {
$lock = $_GET[unlock];
if($fetch2->accesslevel == "0") { die('You cannot unlock this topic'); }
$locked =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$fetch->username' AND id='$lock'"));

$check1=mysql_query("SELECT * FROM topics WHERE id='$lock'");
$chech=mysql_fetch_object($check1);


if($accesslevel > 0 || $lock != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET locked='0' WHERE id='$lock' AND crew = '$fetch2->crew' ");
mysql_query("UPDATE topics SET title='$new_tit2' WHERE id='$lock'");

}else{
mysql_query("UPDATE topics SET locked='0' WHERE id='$lock'");
}

$message= "Unlocked";
$message= "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=forum.php?forum=$forum'>";
}
}
if($_GET[stick]) {
if($fetch2->accesslevel == "0") { die('You cannot sticky this topic'); }
$stick = $_GET[stick];
$check1=mysql_query("SELECT * FROM topics WHERE id='$stick'");
$chech=mysql_fetch_object($check1);
$new_tit=" <b>$chech->title</b>";
$sticky =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$fetch->username' AND id='$stick'"));

if($accesslevel > 0 || $stick != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET sticky='1', lastreply='999999999999999' WHERE id='$stick' AND crew = '$fetch2->crew'");
} else {
mysql_query("UPDATE topics SET sticky='1', lastreply='999999999999999' WHERE id='$stick'");
}

$message= "Stickied";
$message= "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=forum.php?forum=$forum'>";
}
}
if($_GET[unstick]) {
if($fetch2->accesslevel == "0") { die('You cannot unstick this topic'); }
$stick = $_GET[unstick];
$check1=mysql_query("SELECT * FROM topics WHERE id='$stick'");
$chech=mysql_fetch_object($check1);
$new_tit="<b>$chech->title</b>";
$sticky =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$fetch->username' AND id='$stick'"));

if($accesslevel > 0 || $stick != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET sticky='0', lastreply='10' WHERE id='$stick' AND crew = '$fetch2->crew'");
} else {
mysql_query("UPDATE topics SET sticky='0', lastreply='10' WHERE id='$stick'");
}

$message= "UnStickied";
$message= "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=forum.php?forum=$forum'>";
}
}
if($_GET[clean]) {
if($fetch2->accesslevel == "0") { die('You cannot delete this topic'); }
$clean = $_GET[clean];
$cc=mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$fetch->username' AND id='$clean'"));

if($accesslevel > 0 || $clean != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("DELETE FROM topics WHERE id='$clean' AND crew='$fetch2->crew'");
mysql_query("DELETE FROM replys WHERE idto='$clean' AND crew='$fetch2->crew'");
}else{
mysql_query("DELETE FROM topics WHERE id='$clean'");
mysql_query("DELETE FROM replys WHERE idto='$clean'");
}

$message= "Topic Deleted";
$message= "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=forum.php?forum=$forum'>";
}
}

?>
</table><br>

<?php
index_navigation($forum_look, $forum_count, $num);
?>
<p>
<?php include_once"topic.php"; ?>

<?php include("includes/inc-footer.php"); ?>

Dan13071992
12-15-2011, 01:14 PM
forumview.php should be implemended into view.php:



<?php
include('includes/db_connect.php');
include('includes/inc-logincheck.php');
include('includes/inc-functions.php');
include('includes/inc-userfunctions.php');
include('includes/inc-menu.php');
include('includes/smile.php');
$strTitle='Topic View';
$strMessage='';
$intUserID=$_SESSION['uID'];
$fetch=$user;
include('includes/inc-head.php');

$forum=$_GET['forum'];

$viewtopic = $_GET['viewtopic'];
$forum_look=$_GET['forum_look'];
$fetch2=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$fetch->username'"));

$fetch2mute=mysql_fetch_object(mysql_query("SELECT * FROM mute WHERE username='$fetch->username'"));



if($_GET[clean]) {
$clean=$_GET[clean];
if($fetch2->accesslevel == "0") { die('You cannot delete this post!'); }
mysql_query("DELETE FROM replys WHERE id='$clean' AND forum='$forum'") or die ("Cannot delete reply");
echo "Reply Deleted!";
echo "<meta http-equiv='refresh' content='1;url=forumview.php?forum=$forum&viewtopic=$viewtopic'>";
}
if (!$viewtopic){
$viewtopic = "1";
}

if ($forum == "Crew" && $fetch2->crew != "0"){
$crew="1";

}
$owner=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$fetch->username' OR rhm='$fetch->username'"));


$accesslevel=$fetch2->accesslevel;





$ggee = mysql_query("SELECT locked, sticky, lastreply FROM topics WHERE id='$viewtopic' AND forum='$forum'");
while($dsdsd = mysql_fetch_row($ggee)){
$lockedornot = $dsdsd[0];
$stikornot = $dsdsd[1];
$lastreplyit = $dsdsd[2];
}



if ($crew == "1"){
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum' AND crew='$fetch2->crew'");
}else{
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum'");
}
while($success = mysql_fetch_row($gg)){
$fetch->username1 = $success[1];
$topictext = $success[3];
$made = $success[8];
$cat = $success[10];

}

if ($cat == "Questions/Help" || $cat == "Feature Discussion" || $cat == "RIP/WS" || $cat == "Bust Party" || $cat == "Promotions" || $cat == "Other"){
$color="69A16C";
}elseif ($cat == "Contests & Games" || $cat == "Bars" || $cat == "Rate This" || $cat == "Sports" || $cat == "Movies, Music & TV"){
$color="CCAB6B";
}elseif ($cat == "Points" || $cat == "Crew" || $cat == "Pictures & Music" || $cat == "Casino" || $cat == "Protection" || $cat == "Organised Crime"){
$color="6B9FCC";
}

$forumquote2 = mysql_query("SELECT * FROM users WHERE username = '$fetch->username1'");
$fq2 = mysql_fetch_object($forumquote2);

if ($fq2->accesslevel == 4 || $fq2->accesslevel == 5){
$stateaccesslevel="<font color=red><b>$fetch->username1</b></font>";
}elseif ($fq2->accesslevel == 2 || $fq2->accesslevel == 3){
$stateaccesslevel="<font color=green><b>$fetch->username1</b></font>";
}elseif ($fq2->accesslevel == 1){
$stateaccesslevel="<font color=gold><b>$fetch->username1</b></font>";
}elseif ($fq2->accesslevel == 0){
$stateaccesslevel="$fetch->username1";
}
?>

<td background="game/site/site/innerbg.gif" bgcolor="#222222" valign="top" width="99%">

<br>

<center>

<table width=650 border=1 cellspacing=0 cellpadding=2 class=sub3 bordercolor=black><tr><td width="216" align=left2><center class=header><?php echo "<a href='profile.php?viewuser=$fetch->username1'>$stateaccesslevel</a>"; ?></center></td> <td width="217" align=left2><center class=header><?php echo "$made"; ?></center></td> <td width="216" align=left2 style="background-color:#<?php echo $color; ?>;"><center class=TableHeading><?php echo "$cat"; ?></center> </td></tr>

<tr><td colspan=3>

<? echo replace($topictext);
if ($topictext == ""){ $topictext = "Main Forum";}?>


&nbsp;</td></tr></table><br>
<p>


<?php

$forum_count = 15;

function index_navigation($index, $count, $num) {
$forum = $_GET['forum'];
$viewtopic = $_GET['viewtopic'];
if ($index != 0) {
print "<a href=\"forumview.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index - $count) . "\">Previous</a> ";
}
if ($num == $count) {
print " <a href=\"forumview.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index + $count) . "\">Next</a>";
}


}
if (! isset($forum_look) ) {
$forum_look = 0;
}
if ($crew == "1"){
$query="SELECT * FROM replys WHERE idto = '$viewtopic' AND forum='$forum' AND crew='$fetch2->crew' ORDER by `id` DESC LIMIT $forum_look, $forum_count";
}else{
$query="SELECT * FROM replys WHERE idto = '$viewtopic' AND forum='$forum' ORDER by `id` DESC LIMIT $forum_look, $forum_count";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
while($right=mysql_fetch_object($query)){


if ($fq->accesslevel == 4 || $fq->accesslevel == 5){
$stateaccesslevel="<font color=red><b>$right->username</b></font>";
}elseif ($fq->accesslevel == 2 || $fq->accesslevel == 3){
$stateaccesslevel="<font color=green><b>$right->username</b></font>";
}elseif ($fq->accesslevel == 1){
$stateaccesslevel="<font color=gold><b>$right->username</b></font>";
}elseif ($fq->accesslevel == 0){
$stateaccesslevel="$right->username";
}



if ($fetch2->accesslevel > "0"){

$forumquote = mysql_query("SELECT * FROM users WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);
echo "<table width=400 cellspacing=0 cellpadding=2 border=1 class=thinline bordercolor=black bgcolor=#808080 style=border-collapse: collapse><tr>
<td class=header width=650><a href='forumview.php?clean=$right->id&forum=$forum&viewtopic=$viewtopic'><font color=red><b>X</b></font></a> <a href='profile.php?viewuser=$right->username' target=_self>$stateaccesslevel</a> <b>On:</b> $right->made</td></tr>

<tr>
<td width=650 class=sub3>";

echo replace(stripslashes($right->text));

if($fq->forumquote == "") {
echo "</td></tr></table><br>
<p>";
}
else {
echo "</td></tr><tr><td width=650>$fq->forumquote</td></tr></table><br>
<p>"; }
}elseif ($accesslevel == 0){


$forumquote = mysql_query("SELECT * FROM users WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);
echo "<table width=650 cellspacing=0 cellpadding=2 border=1 class=thinline bordercolor=black bgcolor=#808080 style=border-collapse: collapse><tr>
<td class=header width=650><a href='profile.php?viewuser=$right->username' target=_self>$stateaccesslevel</a> <b>On:</b> $right->made</td></tr>

<tr>
<td width=650 class=sub3>";

echo replace(stripslashes($right->text));


if($fq->forumquote == "") {
echo "</td></tr></table><br>
<p>";
}
else {
echo "</td></tr><tr><td width=650>$fq->forumquote</td></tr></table><br>
<p>"; }
}



}
?>
<?php
index_navigation($forum_look, $forum_count, $num);
?>
<br>

<br>

<?

if (!$viewtopic){
$viewtopic = "1";
}

if(strip_tags($_POST['Submit']) && strip_tags($_POST['reply_text']) && $forum && $viewtopic){

$reply_text = addslashes(strip_tags($_POST['reply_text']));

$topic_info=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum'"));


if ($topic_info->sticky == "1"){
$lastreplytime = $topic_info->lastreply;
}elseif ($stikornot == "0"){
$lastreplytime = time();
}



$date = gmdate('Y-m-d h:i:s');



if ($fetch2mute->username == "$fetch->username"){
echo "You are Muted and Cannot Post in the Forums";
exit();
}


if ($crew == "1" && $fetch2->crew != "0"){
mysql_query("INSERT INTO `replys` (`id`, `username`, `text`, `forum`, `idto`,`made`,`crew`) VALUES ('', '$fetch->username', '$reply_text', '$forum', '$viewtopic','$date','$fetch2->crew');") or die (mysql_error());
}else{
mysql_query("INSERT INTO `replys` (`id`, `username`, `text`, `forum`, `idto`,`made`) VALUES ('', '$fetch->username', '$reply_text', '$forum', '$viewtopic','$date');") or die (mysql_error());

}
mysql_query("UPDATE `user_info` SET `posts` = `posts`+1 WHERE username='$fetch->username'");

mysql_query("UPDATE topics SET lastreply='$lastreplytime' WHERE id='$viewtopic'");
echo "

<SCRIPT LANGUAGE='JavaScript'>
window.location='forumview.php?forum=$forum&viewtopic=$viewtopic';
</script>";

}

?>


<script language=JavaScript>
function so(dis)
{
for (i=0;i<dis.elements.length;i++){
if (dis.elements[i].type=='submit')
dis.elements[i].style.visibility='hidden';
}
if(fs==false){
fs=true;
return true;
}else
return false;
}
function goaway()
{
for(i=0;i<document.forms.length;i++)
document.forms[i].onsubmit = function() {return so(this);};
}
</script>

<? if ($topic_info->locked == "1"){
echo "This Topic Is Locked So No More Replys Can Be Added.";

} ?><? if ($lockedornot == '1'){
echo "This Topic Is Locked So No More Replys Can Be Added.";

}elseif ($topic_info->locked != "1" || $lockedornot != '1'){ ?>

<form action='' method=post>
<input name="forumto" type="hidden" value="<?php echo "$forum"; ?>">
<input name="this" type="hidden" id="this" value="<?php echo "$viewtopic"; ?>">

<table width="650" class=sub3 border=1 cellspacing=0 cellpadding=2 width=100% bordercolor="black" style="border-collapse: collapse">
<tr>
<script>

function addemo(emo){

document.tehform.msg.value += emo;

}

</script>
<td background="includes/grad.jpg"><center><font color=#FFFFFF>Reply:</b></font></center></td>
</tr>
<tr>
<td ><center> <div align="center">
<textarea name="reply_text" cols="" rows="5" id="reply_text" style="width: 90%;"></textarea>
<br>
</div></td>
</tr>
<tr>
<td width=33% class=thinline><center><input type=submit value=Submit name=Submit></td>
</tr>
</table>
</form>


<? }?>

<?php include_once"includes/inc-footer.php"; ?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum