Pagina 1 van 3

phpbb integreren in je website

Geplaatst: 05 apr 2005, 16:39
door Yellow
Op het phpbbhacks forum heb ik een soort tutorial gevonden hoe je een soort inlog en registreer vakje krijgt op je site.
Dit is de link:
http://www.phpbbhacks.com/forums/archiv ... b.html#top

FF samengevat, moet dat dan deze code zijn volgens mij:

Code: Selecteer alles

<?php
if($userdata['session_logged_in']){
?>
	You Are Logged In,<br>
	<?php echo $userdata[username] ?>
	<a href="<?php echo $phpbb_root_path2 ?>Forum/profile.php?mode=editprofile">Profile</a> | <a href="/forums/Forum/login.php?logout=true">Logout</a><br>
	<a href="<?php echo $phpbb_root_path2 ?>Forum/privmsg.php?folder=inbox"><?php echo $l_privmsgs_text ?></a><br><br>

	<?php echo $onlinet ?> 

<?php
}else{
?>
	<a href="<?php echo $phpbb_root_path2 ?>Forum/login.php">Login</a><br>
	<a href="<?php echo $phpbb_root_path2 ?>Forum/profile.php?mode=register">Register</a> 

<?php
}

//That's It! Go Back and look over what you don't need.
//Written By AJ Quick, aj@ajquick.com
//Now Go Have Some Fun!
?>
Die code heb ik dus op men site gezet.
Hier kan je dat zien: http://forums.fo.funpic.de/
Linksboven staat een login en register (op word lid moet je niet letten)
Maar het probleem is dat als je inlogt en dan naar de site gaat hij de link naar je profiel en prive berichten niet geeft.
Weet iemand hoe dat komt? Heb ik iets vergeten of iets fout gedaan...?

Geplaatst: 05 apr 2005, 16:40
door Luuk
Als je geen phpbb bestanden include kun je geen $userdata['xxx'] gebruiken.

Geplaatst: 05 apr 2005, 16:44
door Yellow
Dus dan moet ik dit stuk nog doen?
1. Userdata Accessing

In order to use the phpBB login on all the pages of your site, you will need to add the correct code to the headers of all of your non-phpbb pages. I hope you used something easy like making a 'top.php' header you included in all the pages, or else you've got a lot of code to insert on every page. I will explain all the code, then have all the code you need later, so don't worry about copying it now.

First part to add, define in phpBB. This was a security measure added in version 2.0.0 of the software, added to stop people from hacking into your forums and in this case, even yourself.

Code: define('IN_PHPBB', true);

Now, you will need to include the files phpBB uses. This should be fairly simple, and easy to do, all you need to change are the absolute paths to your files.

Code: $site_root_path = '/web/etc/you'; //<-- Modify
$phpbb_root_path2 = '/phpbb2/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'config.php');

Next, you will need to add the user management code, this actually does all the important work. It grabs the userdata from the database for the person if they are logged in. It also will define all the phpBB variables you will end up using for the parts of your site.

Code: $userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

Well, that should be all you need to really actually make users accessible to your site. The very simple code can actually do pretty much all you would want to do, but in the next sections, I will show you how to go the extra mile. Here is the full code for this section:

Code: define('IN_PHPBB', true);

$site_root_path = '/web/etc/you/'; //<-- Modify
$phpbb_root_path2 = '/phpbb2/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

Geplaatst: 05 apr 2005, 16:44
door Paul
ja.

Geplaatst: 05 apr 2005, 16:51
door Yellow
Moet deze code nog tussen php tags?:
$site_root_path = '/web/etc/you/'; //<-- Modify
$phpbb_root_path2 = '/phpbb2/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
En wat moet ik hier invullen: $site_root_path = '/web/etc/you/'; // :?

Geplaatst: 05 apr 2005, 16:53
door Stefandv
Ja moet binnen <? ?> anders werk het niet.
Wat je zoekt is het directe pad naar de files, maak een fout in je php code en je ziet het van zelf staan :)

Geplaatst: 05 apr 2005, 20:11
door Yellow
Ik heb dat stuk in mijn header.php gezet, maar krijg nu de allemaal errors:

http://forums.fo.funpic.de/

dit is men header.php:

Code: Selecteer alles

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style> 
<!-- 

A.type2:link    {color:#095A9C; text-decoration:none; font-family:Verdana; font-size: 10} 
A.type2:visited {color:#095A9C; text-decoration:none; font-family:Verdana; font-size: 10} 
A.type2:active  {color:#095A9C; text-decoration:none; font-family:Verdana; font-size: 10} 
A.type2:hover   {color:#08497F; text-decoration:none; font-family:Verdana; font-size: 10} 

//--> 
</style>
</head>
<body>
<tr>
		<td colspan="3" rowspan="2">
			<img src="images/header_01.gif" width="176" height="82" alt=""></td>
		<td rowspan="2">
			<img src="images/header_02.gif" width="6" height="82" alt=""></td>
		<td style="background: url('images/header_03.gif');  width="102" height="21" ><img src="images/spacer.gif" width="11" height="1"><a class="type2" href="index.php">Home</a></td>
		
  <td class="type2" style="background: url('images/header_04.gif');  width="111" height="21" ><img src="images/spacer.gif" width="15" height="8"><a class="type2" href="index.php">Forum</a></td>
		
  <td style="background: url('images/header_05.gif');  width="115" height="21" ><img src="images/spacer.gif" width="10" height="1"><a class="type2" href="index.php">Adverteren</a></td>
		
  <td colspan="4" style="background: url('images/header_06.gif');  width="114" height="21" ><img src="images/spacer.gif" width="14" height="1"><a class="type2" href="index.php">Over PZ</a></td>
		<td style="background: url('images/header_07.gif');  width="118" height="21" ><img src="images/spacer.gif" width="11" height="1"><a class="type2" href="index.php">Werken bij PZ</a></td>
	</tr>
	<tr>
		<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> 
    var ic =10; 
    var i = new Array(ic); 
    i[0] = "images/random/random_01.gif"; 
    i[1] = "images/random/random_01.gif"; 
    i[2] = "images/random/random_01.gif"; 
    i[3] = "images/random/random_01.gif"; 
    i[4] = "images/random/random_01.gif"; 
    i[5] = "images/random/random_02.gif"; 
    i[6] = "images/random/random_02.gif"; 
    i[7] = "images/random/random_02.gif"; 
    i[8] = "images/random/random_02.gif"; 
    i[9] = "images/random/random_02.gif"; 
        function pickRandom(range) { 
        if (Math.random) 
            return Math.round(Math.random() * (range-1)); 
        else { 
            var now = new Date(); 
            return (now.getTime() / 1000) % range; 
        } 
    } 
    var choice = pickRandom(ic); 
    document.writeln('<td colspan="4" width="407" height="61" alt=""><IMG SRC="' + i[choice] +   '"  BORDER=0></td>'); 
   </SCRIPT></td>
		<td colspan="4">
			<img src="images/header_09.png" width="153" height="61" alt=""></td>
	</tr>
	<tr>
		<td colspan="12">
			<img src="images/header_10.png" width="742" height="11" alt=""></td>
	</tr>
<?
$site_root_path = '/web/etc/you'; //<-- Modify 
$phpbb_root_path2 = '/Forum/'; //<-- Modify 
$phpbb_root_path = $site_root_path . $phpbb_root_path2; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.php'); 

$userdata = session_pagestart($user_ip, PAGE_INDEX); 
init_userprefs($userdata); 
?>
</body>
</html>

Geplaatst: 06 apr 2005, 12:54
door Luuk
Zet dat stuk eens in index.php en niet in header.php.

Geplaatst: 06 apr 2005, 13:12
door Yellow
Dan krijg ik dit: http://forums.fo.funpic.de/

Geplaatst: 06 apr 2005, 13:26
door Paul
staat er een regel met define("IN_PHPBB",true);
in je index?

Geplaatst: 06 apr 2005, 16:06
door Yellow
Ja daar lag het aan bedankt, dat stukje was ik vergeten :oops:

Maar het inloggen doet het nu, maar er staat nog een foutmelding die men site uitrekt, iets over het template bestand van men forum ofzo:

http://forums.fo.funpic.de/

Geplaatst: 06 apr 2005, 16:16
door Paul
template.php wordt 2 keer geincluded.
wordt dit ergens anders ook weergeven?
Geef anders eens index.php van je site?

Geplaatst: 06 apr 2005, 16:24
door Yellow
in index.php staat niks wat met dat script te maken heeft. Hier is menuleft.php:

Code: Selecteer alles

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<link href="playztation.css" rel="stylesheet" type="text/css"> 
</head> 
<body> 
<div class="buttonscontainer"> 
   <div class="buttons"> 
         <table width="125" height="61" border="0" body bgcolor="#2076B9" cellspacing="0" cellpadding="0"> 
     <tr width="125" height="40" body bgcolor="#227BC0"> 
        <br>
<td>

<?
define('IN_PHPBB', true);
$site_root_path = '/usr/export/www/vhosts/funnetwork/hosting/forums/'; //<-- Modify 
$phpbb_root_path2 = '/Forum/'; //<-- Modify 
$phpbb_root_path = $site_root_path . $phpbb_root_path2; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.php'); 

$userdata = session_pagestart($user_ip, PAGE_INDEX); 
init_userprefs($userdata); 
?>

<?php
if($userdata['session_logged_in']){
?>
	You Are Logged In,<br>
	<?php echo $userdata[username] ?>
	<a href="<?php echo $phpbb_root_path2 ?>profile.php?mode=editprofile">Profile</a> | <a href="/forums/Forum/login.php?logout=true">Logout</a><br>
	<a href="<?php echo $phpbb_root_path2 ?>privmsg.php?folder=inbox">Prive Berichten<?php echo $l_privmsgs_text ?></a><br><br>

	<?php echo $onlinet ?> 

<?php
}else{
?>
	<a href="<?php echo $phpbb_root_path2 ?>login.php">Login</a><br>
	<a href="<?php echo $phpbb_root_path2 ?>profile.php?mode=register">Register</a> 

<?php
}

//That's It! Go Back and look over what you don't need.
//Written By AJ Quick, aj@ajquick.com
//Now Go Have Some Fun!
?>
</td> 
      </tr>
<tr width="125" height="40" body bgcolor="#227BC0"> 
        
<td><a class="type3" href="http://forums.fo.funpic.de/Forum/profile.php?mode=register">&nbsp;&nbsp;Word 
          lid </a>
        </td> 
      </tr>
<tr width="125px" height="17px"> 
        <td rowspan="0" style="background: url('images/includemenu.gif'); width:"125px"; height:"17px"; valign="center";><b><font face="Verdana" font size="-2" color="#184D79">&nbsp;&nbsp;<img src="images/design/menupic.gif" width="6" height="6" alt="PlayZtation">&nbsp;PZ</font></b></td > 
      </tr>
 <tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Home</a></td> 
      </tr> 
      <tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr> 
      <tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp;&nbsp;Contact</a></td> 
      </tr>
<tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr> 
      <tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp; Redactie 
          </a></td> 
      </tr>
<tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr>
<tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp; Nieuws</a></td> 
      </tr>
<tr width="125px" height="17px"> 
        <td rowspan="0" style="background: url('images/includemenu.gif'); width:"125px"; height:"17px"; valign="center";><b><font face="Verdana" font size="-2" color="#184D79">&nbsp;&nbsp;<img src="images/design/menupic.gif" width="6" height="6" alt="PlayZtation">&nbsp;Games</font></b></td > 
      
</tr>
<tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Game-info</a></td> 
      </tr> 
      <tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr> 
      <tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp;&nbsp;Previews</a></td> 
      </tr>
<tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr> 
 <tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Releases</a></td> 
      </tr> 
<tr width="125px" height="17px"> 
        <td rowspan="0" style="background: url('images/includemenu.gif'); width:"125px"; height:"17px"; valign="center";><b><font face="Verdana" font size="-2" color="#184D79">&nbsp;&nbsp;<img src="images/design/menupic.gif" width="6" height="6" alt="PlayZtation">&nbsp;Overig</font></b></td > 
      </tr>
<tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Forum</a></td> 
      </tr> 
<tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr>
<tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Informatie</a></td> 
      </tr> 
      <tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr>
<tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Artikelen</a></td> 
      </tr> 
      <tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr>
<tr width="125" body bgcolor="#2076B9"> 
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Extra</a></td> 
      </tr> 
      <tr width="125" > 
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td> 
      </tr>
    </table> 
  </div> 
</div> 
</body> 
</html> 

Geplaatst: 06 apr 2005, 16:45
door Paul
maak er dit van

Code: Selecteer alles

<?
define('IN_PHPBB', true);
$site_root_path = '/usr/export/www/vhosts/funnetwork/hosting/forums/'; //<-- Modify
$phpbb_root_path2 = '/Forum/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="playztation.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="buttonscontainer">
   <div class="buttons">
         <table width="125" height="61" border="0" body bgcolor="#2076B9" cellspacing="0" cellpadding="0">
     <tr width="125" height="40" body bgcolor="#227BC0">
        <br>
<td>
<?php
if($userdata['session_logged_in']){
?>
   You Are Logged In,<br>
   <?= $userdata[username] ?>
   <a href="<?= $phpbb_root_path2 ?>profile.php?mode=editprofile">Profile</a> | <a href="/forums/Forum/login.php?logout=true">Logout</a><br>
   <a href="<?= $phpbb_root_path2 ?>privmsg.php?folder=inbox">Prive Berichten<?= $l_privmsgs_text ?></a><br><br>
   <?= $onlinet ?>
<?php
}else{
?>
   <a href="<?= $phpbb_root_path2 ?>login.php">Login</a><br>
   <a href="<?= $phpbb_root_path2 ?>profile.php?mode=register">Register</a>
<?php
}
//That's It! Go Back and look over what you don't need.
//Written By AJ Quick, aj@ajquick.com
//Now Go Have Some Fun!
?>
</td>
      </tr>
<tr width="125" height="40" body bgcolor="#227BC0">
       
<td><a class="type3" href="http://forums.fo.funpic.de/Forum/profile.php?mode=register">&nbsp;&nbsp;Word
          lid </a>
        </td>
      </tr>
<tr width="125px" height="17px">
        <td rowspan="0" style="background: url('images/includemenu.gif'); width:"125px"; height:"17px"; valign="center";><b><font face="Verdana" font size="-2" color="#184D79">&nbsp;&nbsp;<img src="images/design/menupic.gif" width="6" height="6" alt="PlayZtation">&nbsp;PZ</font></b></td >
      </tr>
 <tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Home</a></td>
      </tr>
      <tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
      <tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp;&nbsp;Contact</a></td>
      </tr>
<tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
      <tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp; Redactie
          </a></td>
      </tr>
<tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
<tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp; Nieuws</a></td>
      </tr>
<tr width="125px" height="17px">
        <td rowspan="0" style="background: url('images/includemenu.gif'); width:"125px"; height:"17px"; valign="center";><b><font face="Verdana" font size="-2" color="#184D79">&nbsp;&nbsp;<img src="images/design/menupic.gif" width="6" height="6" alt="PlayZtation">&nbsp;Games</font></b></td >
     
</tr>
<tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Game-info</a></td>
      </tr>
      <tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
      <tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://forums.fo.funpic.de/Forum/">&nbsp;&nbsp;Previews</a></td>
      </tr>
<tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
 <tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Releases</a></td>
      </tr>
<tr width="125px" height="17px">
        <td rowspan="0" style="background: url('images/includemenu.gif'); width:"125px"; height:"17px"; valign="center";><b><font face="Verdana" font size="-2" color="#184D79">&nbsp;&nbsp;<img src="images/design/menupic.gif" width="6" height="6" alt="PlayZtation">&nbsp;Overig</font></b></td >
      </tr>
<tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Forum</a></td>
      </tr>
<tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
<tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Informatie</a></td>
      </tr>
      <tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
<tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Artikelen</a></td>
      </tr>
      <tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
<tr width="125" body bgcolor="#2076B9">
        <td><a class="type3" href="http://playztation.pl.funpic.de">&nbsp;&nbsp;Extra</a></td>
      </tr>
      <tr width="125" >
        <td><img src="../images/design/menuline.gif" width="125" height="2"></td>
      </tr>
    </table>
  </div>
</div>
</body>
</html>

Geplaatst: 06 apr 2005, 17:08
door Yellow
Nee werkt niet: http://forums.fo.funpic.de/
Fatal error: Cannot redeclare class template in /usr/export/www/vhosts/funnetwork/hosting/forums/Forum/includes/template.php on line 30
Kan het eraan liggen dat menuleft.php in een andere map zit als de rest van me site?

Geplaatst: 06 apr 2005, 17:17
door Paul
nee, template.php wordt er gewoon 2 keer geincluded, das het probleem.

Geplaatst: 06 apr 2005, 19:57
door Yellow
Weet je hoe ik kan zorgen dat template.php 1 keer geincluded word?

Geplaatst: 06 apr 2005, 20:05
door Paul
is het op andere pagina's behalve deze ook?

Geplaatst: 06 apr 2005, 20:07
door Yellow
Ja.

Deze error is er ook:
Warning: Cannot modify header information - headers already sent by (output started at /usr/export/www/vhosts/funnetwork/hosting/forums/index.php:34) in /usr/export/www/vhosts/funnetwork/hosting/forums/Forum/includes/sessions.php on line 196

Warning: Cannot modify header information - headers already sent by (output started at /usr/export/www/vhosts/funnetwork/hosting/forums/index.php:34) in /usr/export/www/vhosts/funnetwork/hosting/forums/Forum/includes/sessions.php on line 197

Geplaatst: 06 apr 2005, 20:13
door Paul
neej, ik bedoel de template foutmelding, is hij op het forum ook?