Connecting forum board accounts to front page of my website

  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Hey guys. I am looking to get my forum board at my website working together with the main site. I would like for the user to have the option to login on the main site, not just on the forums. I would like to go further and be able to feature a lastest threads section on the home page of the main site (not the home page of the forums).

I am running phpbb3 for the forums on my website. I am familiar to non-web programming alot more than web programming, but I believe I am fully capable of reading up on how I can do this and implement it on my website.

Can someone point me in the right direction? This would be a purely php job I am assuming? And also if someone knows of a general guide for this sort of thing a link would be wonderful.

Thanks for all advice guys, really appreciate it.

EDIT - Thanks for the current help all, heres what I currently am trying to do with this site...

Basically I would like my home page to do the following:
1 - Check to see if the visitor on the home page is logged into the forums
2 - If yes, display this information on the home page
3 - If no, display that the visitor is not logged in the forums on the home page
4 - Provide a log in box and register link on the home page for the forums (Already have this done thanks to natas :D )
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

Here's the code I use for one of my sites, maybe you can use it as rough guide.

EDIT: This just allows users to register from a "home" page of your site away from the forums and automatically register for the forums.

Code: [ Select ]
{
    // username and password and email sent from form
    $username=$_POST['username'];
    $password=$_POST['password'];
    $user_email=$_POST['email'];
    
    // CHECK YOUR $_POST VARIABLES TO MAKE SURE THEY'RE VALID.
    
    if ($tests==false) // TOTALLY GENERIC, YOU WILL HAVE TO RUN YOUR OWN TESTS
    {
        header("location: error.php");
    }
    else    
    {
        // PHPBB requires this so it doesn't kick you out of the pages or produce an error
        define('IN_PHPBB', true);
        $phpbb_root_path = 'forums/';
        $phpEx = substr(strrchr(__FILE__, '.'), 1);
        include($phpbb_root_path . 'common.php');
        include($phpbb_root_path . 'includes/functions_user.php');
        include($phpbb_root_path . 'includes/ucp/ucp_register.php');


        // Forum Database Variables
        $host="yourhost.yourhostdomain.com"; // Host name
        $dbusername="username"; // Mysql username
        $dbpassword="databasepassword"; // Mysql password
        $db_name="databasename"; // Database name
        $users_tbl="phpbb_users"; // Table name for PHPBB Users
        $group_tbl="phpbb_user_group"; // Table Name for PHPBB Groups

        // Connect to server and select database
        mysql_connect("$host", "$dbusername", "$dbpassword")or die("cannot connect");
        mysql_select_db("$db_name")or die("cannot select DB");

        // A check to see if the username is unique
        $sql="SELECT * FROM $users_tbl WHERE username='$username'";
        $result=mysql_query($sql);
        $count=mysql_num_rows($result);
    
        // A check to see if the email is unique
        $sql2="SELECT * FROM $users_tbl WHERE user_email='$user_email'";
        $result2=mysql_query($sql2);
        $count2=mysql_num_rows($result2);

        if($count==1)
        {
            header("location: error.php");
        }
        elseif($count2==1)
        {
            header("location: error.php");
        }
        else
        {

    $sql_ary = array(
      'username'     => $username,
      'username_clean'  => $username_clean,
      'user_password'   => phpbb_hash($password),
      'user_pass_convert' => 0,
      'user_email'    => $user_email,
      'user_email_hash'  => crc32(strtolower($user_email)) . strlen($user_email),
      'group_id'     => 2,
      'user_type'     => 0,
    );
  user_add($sql_ary);
        }
    }
}
  1. {
  2.     // username and password and email sent from form
  3.     $username=$_POST['username'];
  4.     $password=$_POST['password'];
  5.     $user_email=$_POST['email'];
  6.     
  7.     // CHECK YOUR $_POST VARIABLES TO MAKE SURE THEY'RE VALID.
  8.     
  9.     if ($tests==false) // TOTALLY GENERIC, YOU WILL HAVE TO RUN YOUR OWN TESTS
  10.     {
  11.         header("location: error.php");
  12.     }
  13.     else    
  14.     {
  15.         // PHPBB requires this so it doesn't kick you out of the pages or produce an error
  16.         define('IN_PHPBB', true);
  17.         $phpbb_root_path = 'forums/';
  18.         $phpEx = substr(strrchr(__FILE__, '.'), 1);
  19.         include($phpbb_root_path . 'common.php');
  20.         include($phpbb_root_path . 'includes/functions_user.php');
  21.         include($phpbb_root_path . 'includes/ucp/ucp_register.php');
  22.         // Forum Database Variables
  23.         $host="yourhost.yourhostdomain.com"; // Host name
  24.         $dbusername="username"; // Mysql username
  25.         $dbpassword="databasepassword"; // Mysql password
  26.         $db_name="databasename"; // Database name
  27.         $users_tbl="phpbb_users"; // Table name for PHPBB Users
  28.         $group_tbl="phpbb_user_group"; // Table Name for PHPBB Groups
  29.         // Connect to server and select database
  30.         mysql_connect("$host", "$dbusername", "$dbpassword")or die("cannot connect");
  31.         mysql_select_db("$db_name")or die("cannot select DB");
  32.         // A check to see if the username is unique
  33.         $sql="SELECT * FROM $users_tbl WHERE username='$username'";
  34.         $result=mysql_query($sql);
  35.         $count=mysql_num_rows($result);
  36.     
  37.         // A check to see if the email is unique
  38.         $sql2="SELECT * FROM $users_tbl WHERE user_email='$user_email'";
  39.         $result2=mysql_query($sql2);
  40.         $count2=mysql_num_rows($result2);
  41.         if($count==1)
  42.         {
  43.             header("location: error.php");
  44.         }
  45.         elseif($count2==1)
  46.         {
  47.             header("location: error.php");
  48.         }
  49.         else
  50.         {
  51.     $sql_ary = array(
  52.       'username'     => $username,
  53.       'username_clean'  => $username_clean,
  54.       'user_password'   => phpbb_hash($password),
  55.       'user_pass_convert' => 0,
  56.       'user_email'    => $user_email,
  57.       'user_email_hash'  => crc32(strtolower($user_email)) . strlen($user_email),
  58.       'group_id'     => 2,
  59.       'user_type'     => 0,
  60.     );
  61.   user_add($sql_ary);
  62.         }
  63.     }
  64. }
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

To allow users to login:

Code: [ Select ]
<form action="./phpBB3/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">Password:</label>&nbsp;
    <input type="password" name="password" id="password" size="20" title="Password" />
    <input type="hidden" name="redirect" value="whereyouwanttheusertoendup.php" />
    <input type="submit" name="login" value="LOGIN" />
</form>
  1. <form action="./phpBB3/ucp.php?mode=login" method="post">
  2.     <label for="username">Username:</label>&nbsp;
  3.     <input type="text" name="username" id="username" size="20" title="Username" />
  4.     <label for="password">Password:</label>&nbsp;
  5.     <input type="password" name="password" id="password" size="20" title="Password" />
  6.     <input type="hidden" name="redirect" value="whereyouwanttheusertoendup.php" />
  7.     <input type="submit" name="login" value="LOGIN" />
  8. </form>
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Thank you so much natas. I will work with the code you gave me and report back with results.

Take care
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Hey Natas (or whoever wants to help), I pretty much did some copy/paste on the first code you posted on my home page. I saved my home page as a php file and just inserted the code right where I wanted it.

I of course changed the important info (host name, user for database, etc). But I am getting the following error on my page online now...


Warning: Cannot modify header information - headers already sent by (output started at /hermes/web06/b2402/moo.stonerlifestylecom/index.php:8) in /hermes/web06/b2402/moo.stonerlifestylecom/index.php on line 110

Now I did not edit the "run your own test here" part you had in the code. I am assuming I am getting this error because of this? I am talking about this code here:
Code: [ Select ]
if ($tests==false) // TOTALLY GENERIC, YOU WILL HAVE TO RUN YOUR OWN TESTS
  {
    header("location: error.php");
  }
  1. if ($tests==false) // TOTALLY GENERIC, YOU WILL HAVE TO RUN YOUR OWN TESTS
  2.   {
  3.     header("location: error.php");
  4.   }


Thanks for all replies.
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

My code wasn't really meant to be copy/pasted. Looking back at it, I didn't even removed the opening brackets on line 1. lol.

Those headers are just redirects in case of an error, you can handle errors however you wish. The reason you are seeing "headers already sent" errors is because of some kind of output buffering deal. (I'll be honest. I don't really understand it).

I just add
ob_start();

to the top of my pages, and that seems to solve the problem.

You might want to check the PHP website to get more information.
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

I decided to run your second code, and that works wonderfully. I think registering from my home page is not a big deal to me, I will just link to register under the login.

I would really like to learn a way to display that the user is logged into the forums while on the home page. Would this be relatively simple to do? If so how would I go about it?

Basically I would like my home page to do the following:
1 - Check to see if the visitor on the home page is logged into the forums
2 - If yes, display this information on the home page
3 - If no, display that the visitor is not logged in the forums on the home page
4 - Provide a log in box and register link on the home page for the forums (Already have this done thanks to natas :D )
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

Add this to the top of any page you wish to access PHPBB session information

Code: [ Select ]
  <?php
  define('IN_PHPBB', true);
  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  $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 : './';
  4.   $phpEx = substr(strrchr(__FILE__, '.'), 1);
  5.   include($phpbb_root_path . 'common.' . $phpEx);
  6.   $user->session_begin();
  7.   $auth->acl($user->data);
  8.   $user->setup();
  9.   ?>


To check if a user is logged in:

Code: [ Select ]
<?php
if ($user->data['user_id'] == ANONYMOUS)
{
  echo "USER IS NOT LOGGED IN"; // or whatever else you want it to say
}

else
{
  echo "USER IS LOGGED IN"; // same here, edit the output as you wish
}

?>
  1. <?php
  2. if ($user->data['user_id'] == ANONYMOUS)
  3. {
  4.   echo "USER IS NOT LOGGED IN"; // or whatever else you want it to say
  5. }
  6. else
  7. {
  8.   echo "USER IS LOGGED IN"; // same here, edit the output as you wish
  9. }
  10. ?>
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Thank you so much Natas, I have been able to successfully run everything I want to run. The only thing I have left is how do I echo back the username of the site visitor if they are logged in?

I have the following code working here for this part but just don't know how I can echo back the user's name.

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" />
  </form>         

<?php }
else
{
 echo $user->data['user_name']; //This line does not work, I was just testing things
 echo "You are logged in."; // same here, edit the output as you wish
}
?>
  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" />
  15.   </form>         
  16. <?php }
  17. else
  18. {
  19.  echo $user->data['user_name']; //This line does not work, I was just testing things
  20.  echo "You are logged in."; // same here, edit the output as you wish
  21. }
  22. ?>
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

$user->data['username']
or
$user->data['username_clean']

I can't remember
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

$user->data['username'] initially displayed some error at the top with warnings about some header info already being sent or something. But suddenly after a run through of tests to see if it functions properly (which it did) the errors were just all gone.

I have cycled through the pages more than a few times to test it all and there hasn't been an error since the first time I tried it. Weird but nice.

So I guess I got everything I need solved.

Have a wonderful day all, especially natas!
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Sorry one last thing guys...I am randomly seeing this error on my home page when you are not logged in yet. Once you log in, it goes away...

[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1035: Cannot modify header information - headers already sent by (output started at /hermes/web06/b2402/moo.stonerlifestylecom/index.php:8)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1035: Cannot modify header information - headers already sent by (output started at /hermes/web06/b2402/moo.stonerlifestylecom/index.php:8)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1035: Cannot modify header information - headers already sent by (output started at /hermes/web06/b2402/moo.stonerlifestylecom/index.php:8)

EDIT: I will note that the home page is still fully functional with the error messages just showing up on the top of the screen.
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

You could just turn error reporting off :)

Code: [ Select ]
error_reporting("E_ALL");

But that's kinda ignoring the problem.

Every time I get that header error, I just add this to the top of my page.

Code: [ Select ]
ob_start();


http://php.net/manual/en/function.ob-start.php
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

I inserted the ob_start(); line into various places on the home page and session.php file and could not get the error message to leave.

I also tried inserting the error message off thing as a test on the index and that did not make the error message leave either...

I must be placing the code in the wrong file/area of file?
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

Did u place them inside PHP tags and on the top of your home page?
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Of course : )
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

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.
  • StonerLifestyle
  • Newbie
  • Newbie
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

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
  • StonerLifestyle
  • Posts: 11

Post 3+ Months Ago

Been trying lots of things with no success. Can't seem to get the header debug error to go away : (
  • snares
  • Born
  • Born
  • snares
  • Posts: 1

Post 3+ Months Ago

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 125 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.