Jump to content

Forums [SPECIFIC PROBLEM]


Letterbomb05

Recommended Posts

Hi,

  I'm having a specific problem with some forum foundations I've made. The viewtopic file SHOULD look like this: http://browsershots.org/screenshots/9de7bdd5b1e8988032b43d4734982534/

 

^ and most of the time, it does. HOWEVER, on SOME of my users computers, there is a strange problem, and here is what they are seeing: http://browsershots.org/screenshots/ce44ac46c023d3f738ca7232b0ff2056/

As you can see the main problem that I'm concerned about here is why the username of the poster, and their information (rank and forum posts) are not being displayed. I have been up to my friends house were he is having the problem, and he is running a normal Dell PC with windows XP and the problem persists in IE7, Firefox 2.0 and Firefox 3.0 :S

 

here is SOME of the viewtopic.php file where the problem is happening:

//get topic id from url
$topic_id = $_GET['topic_id'];

//query db to retrieve the topic info
$query = "SELECT * FROM topics WHERE topic_id='".$topic_id."'";
$result = mysql_query($query)or die(mysql_error());

$row = mysql_fetch_assoc($result);
$topic_contents = stripslashes($row['contents']);

//get current users username
if(isset($_SESSION['registered'])){
    $user = $_SESSION['registered'];
}
if(isset($_SESSION['member'])){
    $user = $_SESSION['member'];
}
if(isset($_SESSION['moderator'])){
    $user = $_SESSION['moderator'];
}
if(isset($_SESSION['admin'])){
    $user = $_SESSION['admin'];
}

//make sure that only people with the correct rank can access the topic
$accesslvl = $row['forum_id'];
if(isset($_SESSION['registered'])){
if($accesslvl > 3333){
	echo "Access Denied";
	die();
}
}
if(isset($_SESSION['member'])){
if($accesslvl > 6666){
	echo "Access Denied";
	die();
}
}
//query db for the name of the forum that the thread is under
$query90 = "SELECT * FROM forums WHERE forumid='".$row['forum_id']."'";
$result90 = mysql_query($query90)or die(mysql_error());
$row90 = mysql_fetch_assoc($result90);
$topic_poster = $row['topic_poster'];
?>

<!--container-->

<div style="float:left;color:#FFFFFF;font-family:trebuchet MS;">
<a href="index.php">Forums</a> -> <a href="viewforum.php?forumid=<?php echo $row90['forumid']; ?>"><?php echo $row90['name']; ?></a> -> 
<strong><?php echo $row['subject']; ?></strong><br />
</div>

<br />
<div style="margin-top:5%;display:block;margin-bottom:1%;">
<!--topic-->
<table style="display:block;float:left;font-family:sans-serif;color:#C0C0C0;text-align:left;margin-top:1%;">
<tr>
	<td width="200px" style="background:#252525;">
	<table margin="0px" cellpadding="0" cellspacing="0" style="margin-top:-10%;width:100%;">
	<tr>
	<td style="text-align:center;font-size:10pt;width:100%;font-family:trebuchet MS;"><strong><?php echo $topic_poster; ?></strong></td><br />
	</tr>

	<?php
	//get information about the reply poster
	$queryposter2 = "SELECT * FROM users WHERE username='".$topic_poster."'";
	$poster_result2 = mysql_query($queryposter2)or die(mysql_error());
	$poster_row2 = mysql_fetch_assoc($poster_result2);
	$posts = $poster_row2['forum_posts'];
	if($poster_row2['rank'] == 1){
        $topic_poster_rank = "Registered User";
    }
    if($poster_row2['rank'] == 2){
        $topic_poster_rank = "TR Member";
    }
    if($poster_row2['rank'] == 3){
        $topic_poster_rank = "Moderator";
    }
    if($poster_row2['rank'] == 4){
        $topic_poster_rank = "Administrator";
    }
	?>

	<tr>
	<td style="font-size:10pt;font-family:trebuchet MS;text-align:center;"><?php echo $topic_poster_rank; ?></td>
	</tr><tr>
	<td style="font-size:10pt;font-family:trebuchet MS;text-align:center;">Posts: <?php echo $posts; ?></td>
	</tr>
	</table></td>

	<td width="1000px" style="background:#252525;font-size:10pt;font-size:sans-serif;"><?php echo nl2br($topic_contents); ?></td>
</tr>
</table>
<br />
<?php

//get replies
$query2 = "SELECT * FROM topic_replys WHERE topic_id='".$topic_id."' ORDER BY reply_datetime ASC";
$result2 = mysql_query($query2)or die(mysql_error());


while($row2 = mysql_fetch_assoc($result2)){
$reply_contents = stripslashes($row2['reply_contents']);
?>
<br />
<br />
<table style="display:block;float:left;font-family:sans-serif;color:#C0C0C0;text-align:left;">
<tr>
	<td width="200px" style="background:#252525;">
	<table margin="0px" cellpadding="0" cellspacing="0" style="margin-top:-10%;width:100%;">
	<tr>
	<td style="text-align:center;font-size:10pt;width:100%;font-family:trebuchet MS;"><strong><?php echo $row2['reply_poster']; ?></strong></td><br />
	</tr>

	<?php
	//get information about the reply poster
	$queryposter = "SELECT * FROM users WHERE username='".$row2['reply_poster']."'";
	$poster_result = mysql_query($queryposter)or die(mysql_error());
	$poster_row = mysql_fetch_assoc($poster_result);
	$forum_posts = $poster_row['forum_posts'];
	if($poster_row['rank'] == 1){
        $rank = "Registered User";
    }
    if($poster_row['rank'] == 2){
        $rank = "TR Member";
    }
    if($poster_row['rank'] == 3){
        $rank = "Moderator";
    }
    if($poster_row['rank'] == 4){
        $rank = "Administrator";
    }
	?>
	<tr>
	<td style="font-size:10pt;font-family:trebuchet MS;text-align:center;"><?php echo $rank; ?></td>
	</tr><tr>
	<td style="font-size:10pt;font-family:trebuchet MS;text-align:center;">Posts: <?php echo $forum_posts; ?></td>
	</tr>
	</table></td>

 

The second problem, is on this users computer, in firefox only, when they login in on the main site, then click on the forums link, it says they are not logged in, when they are :S

 

Any help or suggestions as to why any of these problems are happening and any possible solutions are much appreciated!

 

 

(Sorry for the very bad coding, I havn't been doing PHP all that long, and this is the first time i've done anything big >_<)

Link to comment
https://forums.phpfreaks.com/topic/111877-forums-specific-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.