PHPBB inlogscript inpassen in je eigen website inlogsysteem

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Sander Spijk

Sander Spijk

28/12/2005 18:38:00
Quote Anchor link
Om je website met inlogsysteem zo aan te passen dta iemand die op je webiste ingelogd is, ook automatisch ingelogd is in je phpbb forum heb ik een script gevonden.

Nu werkt dit script met een class , maar ik weet niet wat dat precies is en hoe je dit in je pagina moet invoegen... Iemand een idee?

Bij de weg, als het werkt zal ik het hele script wel even posten, want het lijkt me handig....
 
PHP hulp

PHP hulp

19/04/2024 18:58:29
 
Han eev

Han eev

28/12/2005 18:43:00
Quote Anchor link
om de class te 'starten'
doe je

$class = new classnaam;

om een functie aan te roepen doe je

$class->functienaam(parameters, van, de, functie);

Maar dat zo'n script bestaat vind ik wel raar
 
Sander Spijk

Sander Spijk

28/12/2005 18:57:00
Quote Anchor link
Dit is de class die in het script wordt gemaakt:

class PHPBB_Login {

function PHPBB_Login() {
}

function login( $phpbb_user_id ) {
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;

// Setup the phpbb environment and then
// run through the phpbb login process

// You may need to change the following line to reflect
// your phpBB installation.
require_once( './forum/config.php' );

define('IN_PHPBB',true);

// You may need to change the following line to reflect
// your phpBB installation.
$phpbb_root_path = "./forum/";

require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );

return session_begin( $phpbb_user_id, $user_ip, PAGE_INDEX, FALSE, TRUE );

}

function logout( $session_id, $phpbb_user_id ) {
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;

// Setup the phpbb environment and then
// run through the phpbb login process

// You may need to change the following line to reflect
// your phpBB installation.
require_once( './forum/config.php' );

define('IN_PHPBB',true);

// You may need to change the following line to reflect
// your phpBB installation.
$phpbb_root_path = "./forum/";

require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );

session_end( $session_id, $phpbb_user_id );

// session_end doesn't seem to get rid of these cookies,
// so we'll do it here just in to make certain.
setcookie( $board_config[ "cookie_name" ] . "_sid", "", time() - 3600, " " );
setcookie( $board_config[ "cookie_name" ] . "_mysql", "", time() - 3600, " " );

}

}

?>
 
Sander Spijk

Sander Spijk

28/12/2005 18:59:00
Quote Anchor link
Maar mijn vraag is of ik deze nou in de header van een pagina moet zetten, moet includen of als een apart bestand op de server zet en aanroep via een functie, ik heb eigenlijk geen idee.....

en nu vond ik een tutorial (http://www.phphulp.nl/php/tutorials/8/301/) op deze pagina die daar over gaat, maar daar wordt ik eigenlijk niet wijzer uit. Ik kan in ieder geval niet vinden hoe je een class in je pagina zet....
 
Sander Spijk

Sander Spijk

28/12/2005 19:00:00
Quote Anchor link
Daarbij zitten er nog 2 voorbeeld bij om het hele spul aan te roepen:

/* Example 1: Logging in */

session_start();

/* First, login the user using your own login system, for example; */
$user = new User();

// username and password are implied here,
// they will most likely be form variables
$user->login( $username, $password );

// Then login the user to the forum
$phpBB = new PHPBB_Login();

$phpbb->login( $user->id );




/* Example 2: Logging out */

session_id();

$user = new User();

/* First, logout the user from the forum */
$phpBB = new PHPBB_Login();

$phpbb->logout( session_id(), $user->id) ;

/* Then logout the user from your own login system */
$user->logout( $user->id );

?>

Maar hoe zet je de class in de website?
Gewijzigd op 28/12/2005 19:01:00 door Sander Spijk
 
Willem Jan Z

Willem Jan Z

28/12/2005 19:08:00
Quote Anchor link
Zoals in voorbeeld 1 staat...

Je hebt dit zinnetje: $user->login($username,$password);

Die username en het password krijg je uit jouw inlogform...
 
Sander Spijk

Sander Spijk

28/12/2005 19:11:00
Quote Anchor link
Ja, dat snap ik wel, mijn vraag was misschien niet duidelijk genoeg, dus ik zal hem hieronder een keer anders stellen:

Waar in je website plaats je de CLASS?

Moet deze:
a) In een apart bestand, Aanroepen via......
b) In de header van de pagina (of ervoor misschien)
c) In de body van je pagina
d) Anders namelijk.....
 
Kalle P

Kalle P

28/12/2005 19:37:00
Quote Anchor link
tussen de <body></body> moet het wel lukken lijkt me.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.