Connecting forum board accounts to front page of my website

  • StonerLifestyle
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Mar 14, 2012
  • Posts: 11
  • Status: Offline

Post March 16th, 2012, 4:19 pm

Of course : )
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 16th, 2012, 4:19 pm

  • natas
  • PHP Ninja
  • Proficient
  • No Avatar
  • Joined: Mar 28, 2009
  • Posts: 305
  • Loc: AFK
  • Status: Offline

Post March 16th, 2012, 4:34 pm

OK... I just found out it could be a problem with whitespace...

start off by removing the error reporting and ob_start codes. That way you start off where you initially found the problem.

It seems that this is a whitespace issue after I did some digging.

go to your index page (index.php), and look for whitespace that your text editor might have entered. I'm guessing that the ":8" at the end of the error could mean line 8. start by looking there.
Custom Web Design
  • StonerLifestyle
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Mar 14, 2012
  • Posts: 11
  • Status: Offline

Post March 16th, 2012, 6:19 pm

Interesting idea about the whitespace causing the error message to be displayed...

I removed the error reporting and ob_start code, and came back to the original code that gave me the error. I looked around for anything that caught my eye, and any unusual whitespaces any of the software used could have added by accident. Don't see anything unusual.

Line 8 in the index page is just some javascript used for image rollovers for the menu. Since this code has been here since long before the issue I am assuming that line 8 is really not the issue causing the error message. I am going to post some code from my index page and see if anyone sees something I am missing that could cause this header error.

Code: [ Select ]
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>Stoner Lifestyle</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0 //THIS IS LINE 8, I don't think this is causing any errors regarding headers right?
 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
 if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
  1. <head>
  2. <link rel="stylesheet" type="text/css" href="mystyle.css" />
  3. <title>Stoner Lifestyle</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <script type="text/JavaScript">
  6. <!--
  7. function MM_swapImgRestore() { //v3.0 //THIS IS LINE 8, I don't think this is causing any errors regarding headers right?
  8.  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  9. }
  10. function MM_preloadImages() { //v3.0
  11.  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  12.   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  13.   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  14. }
  15. function MM_findObj(n, d) { //v4.01
  16.  var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  17.   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  18.  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  19.  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  20.  if(!x && d.getElementById) x=d.getElementById(n); return x;
  21. }
  22. function MM_swapImage() { //v3.0
  23.  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  24.   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  25. }
  26. //-->
  27. </script>
  28. </head>


Using this code to open up a session with the forum database on the index page
Code: [ Select ]
<?php
 define('IN_PHPBB', true);
 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forum/';
 $phpEx = substr(strrchr(__FILE__, '.'), 1);
 include($phpbb_root_path . 'common.' . $phpEx);
 include($phpbb_root_path . 'includes/functions_display.' . $phpEx); //for importing lastest threads info from the forum
 $user->session_begin(); 
 $auth->acl($user->data);
 $user->setup();
 ?>
  1. <?php
  2.  define('IN_PHPBB', true);
  3.  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forum/';
  4.  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  5.  include($phpbb_root_path . 'common.' . $phpEx);
  6.  include($phpbb_root_path . 'includes/functions_display.' . $phpEx); //for importing lastest threads info from the forum
  7.  $user->session_begin(); 
  8.  $auth->acl($user->data);
  9.  $user->setup();
  10.  ?>


This is the last of the php on my index page, it is used to check if the user is logged into the forums, and gives a login box if not and displays username/link to control panel if you are logged in.

Code: [ Select ]
<?php
if ($user->data['user_id'] == ANONYMOUS) {
?>
  <form action="./forum/ucp.php?mode=login" method="post">
  <label for="username">Username:</label>
  &nbsp;
  <input type="text" name="username" id="username" size="20" title="Username" />
  <label for="password"><br>
  Password:</label>
  &nbsp;
  <input type="password" name="password" id="password" size="20" title="Password" />
  <input type="hidden" name="redirect" value="./index.php" />
  <br>
  <input type="submit" name="login" value="LOGIN" />&nbsp;&nbsp;<a href="./forum/ucp.php?mode=register">Register Now</a>&nbsp;
    <a href='./forum/ucp.php?mode=sendpassword'>Forget Password?</a>
  </form>        
     

<?php }
else
{
 echo "What's up ";
 echo $user->data['username'];
 echo "? You're logged into SLS.";
 echo " Click <a href='./forum/ucp.php'>here</a> to go to your control panel.";
}
?>
<!--- The following is for displaying the lastest threads ---->
<? 
  /*** phpBB3 - Last Active Topics System ***/
  //Show last x topics
  define('TOPICS_LIMIT',4);

  // Create arrays
  $topics = array();
  
  // Get forums that current user has read rights to.
  $forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
  
  // Get active topics.
  $sql="SELECT *
  FROM " . TOPICS_TABLE . "
  WHERE topic_approved = '1' AND " . $db->sql_in_set('forum_id', $forums) . "
  ORDER BY topic_last_post_time DESC";
  $result = $db->sql_query_limit($sql,TOPICS_LIMIT);
  while ($r = $db->sql_fetchrow($result))
  {
    $topics[] = $r;
  }
  $db->sql_freeresult($result);
?>
<div>
<?
    
  foreach($topics as $t)
  {
    // Get folder img, topic status/type related information
    $topic_tracking_info = get_complete_topic_tracking($t['forum_id'], $t['topic_id']);
    $unread_topic = (isset($topic_tracking_info[$t['topic_id']]) && $t['topic_last_post_time'] > $topic_tracking_info[$t['topic_id']]) ? true : false;
    $folder_img = $folder_alt = $topic_type = '';
    topic_status($t, $t['topic_replies'], $unread_topic, $folder_img, $folder_alt, $topic_type);
    
    // output the link
    ?>
      <img style="vertical-align: text-bottom" src="<?=$user->img($folder_img, $folder_alt, false, '', 'src');?>" title="<?=$user->lang[$folder_alt];?>" alt="<?=$user->lang[$folder_alt];?>" />
      <a href="<?=$phpbb_root_path . 'viewtopic.php?f=' . $t['forum_id'] . '&amp;t=' . $t['topic_id'] . '&amp;p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id'];?>"><?=html_entity_decode($t['topic_title']);?></a><br />
  <?
  }
  ?>
</div>
  1. <?php
  2. if ($user->data['user_id'] == ANONYMOUS) {
  3. ?>
  4.   <form action="./forum/ucp.php?mode=login" method="post">
  5.   <label for="username">Username:</label>
  6.   &nbsp;
  7.   <input type="text" name="username" id="username" size="20" title="Username" />
  8.   <label for="password"><br>
  9.   Password:</label>
  10.   &nbsp;
  11.   <input type="password" name="password" id="password" size="20" title="Password" />
  12.   <input type="hidden" name="redirect" value="./index.php" />
  13.   <br>
  14.   <input type="submit" name="login" value="LOGIN" />&nbsp;&nbsp;<a href="./forum/ucp.php?mode=register">Register Now</a>&nbsp;
  15.     <a href='./forum/ucp.php?mode=sendpassword'>Forget Password?</a>
  16.   </form>        
  17.      
  18. <?php }
  19. else
  20. {
  21.  echo "What's up ";
  22.  echo $user->data['username'];
  23.  echo "? You're logged into SLS.";
  24.  echo " Click <a href='./forum/ucp.php'>here</a> to go to your control panel.";
  25. }
  26. ?>
  27. <!--- The following is for displaying the lastest threads ---->
  28. <? 
  29.   /*** phpBB3 - Last Active Topics System ***/
  30.   //Show last x topics
  31.   define('TOPICS_LIMIT',4);
  32.   // Create arrays
  33.   $topics = array();
  34.   
  35.   // Get forums that current user has read rights to.
  36.   $forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
  37.   
  38.   // Get active topics.
  39.   $sql="SELECT *
  40.   FROM " . TOPICS_TABLE . "
  41.   WHERE topic_approved = '1' AND " . $db->sql_in_set('forum_id', $forums) . "
  42.   ORDER BY topic_last_post_time DESC";
  43.   $result = $db->sql_query_limit($sql,TOPICS_LIMIT);
  44.   while ($r = $db->sql_fetchrow($result))
  45.   {
  46.     $topics[] = $r;
  47.   }
  48.   $db->sql_freeresult($result);
  49. ?>
  50. <div>
  51. <?
  52.     
  53.   foreach($topics as $t)
  54.   {
  55.     // Get folder img, topic status/type related information
  56.     $topic_tracking_info = get_complete_topic_tracking($t['forum_id'], $t['topic_id']);
  57.     $unread_topic = (isset($topic_tracking_info[$t['topic_id']]) && $t['topic_last_post_time'] > $topic_tracking_info[$t['topic_id']]) ? true : false;
  58.     $folder_img = $folder_alt = $topic_type = '';
  59.     topic_status($t, $t['topic_replies'], $unread_topic, $folder_img, $folder_alt, $topic_type);
  60.     
  61.     // output the link
  62.     ?>
  63.       <img style="vertical-align: text-bottom" src="<?=$user->img($folder_img, $folder_alt, false, '', 'src');?>" title="<?=$user->lang[$folder_alt];?>" alt="<?=$user->lang[$folder_alt];?>" />
  64.       <a href="<?=$phpbb_root_path . 'viewtopic.php?f=' . $t['forum_id'] . '&amp;t=' . $t['topic_id'] . '&amp;p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id'];?>"><?=html_entity_decode($t['topic_title']);?></a><br />
  65.   <?
  66.   }
  67.   ?>
  68. </div>


Sorry for the super long post, I just wanted to post everything that could be relevant in finding the cause to this pesky header error.

Thanks again :D
  • StonerLifestyle
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Mar 14, 2012
  • Posts: 11
  • Status: Offline

Post March 17th, 2012, 6:08 pm

Been trying lots of things with no success. Can't seem to get the header debug error to go away : (
  • snares
  • Born
  • Born
  • No Avatar
  • Joined: Oct 12, 2012
  • Posts: 1
  • Status: Offline

Post October 12th, 2012, 12:54 pm

StonerLifestyle wrote:
Been trying lots of things with no success. Can't seem to get the header debug error to go away : (


Sorry to bump this thread, but I am having the same exact problems as the OP and no matter what I try the header errors will not go away. My error messages are also appearing at the top of my web pages seemingly at random, always while not logged in to my phpbb account. If I navigate to a different page and then back, the errors will disappear for a while before reappearing at a later page load.

Any ideas would be greatly appreciated!

Thanks.

Post Information

  • Total Posts in this topic: 20 posts
  • Users browsing this forum: No registered users and 124 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.