Topic: Implement PunBB into my Site[How to]
Hello all,
I've been strugling around in the codes of PunBB but it doesnt look that i can fix this on my self.
I run a community site at this moment and i like to use the PunBB as a BB. But it can;t be that the users have to log in for 2 times if they like to use the BB. Wich steps have i to make to implement my PunBB into my site.
To help the experts over here i have some code pasted under here (the name of the cookie etc aren't the real).
( i think that that is the biggest deal.. The cookie etc.)
So can you help me?
The code:
<?php
if(loggedin( ) == false) {
?>
<script language="javascript">
window.defaultStatus = "Loggedout.";
</script>
<style type="text/css" media="screen">
@import url("./ph.css");
</style>
<div class="menu_txt">
<form name="login" action="leden/login.php" method="post">
Username:<br>
<input type="text" SIZE="12" class="input" value="" name="username" onFocus="clearThis(' Username',this)" onBlur="fillThis(' Loginnaam',this)"><br>
Password:<br>
<input type="password" SIZE="12" class="input" value="" name="password" onFocus="clearThis(' Password',this)" onBlur="fillThis(' Password',this)"><br>
<input type="submit" class="submit" value=" LOGIN! " style="color: black;"><br>
</form>
</div>
</div>
<?
}
And the cookie stuff
## Database connection ##
$db['connect'] = mysql_connect( $config['db']['host'], $config['db']['user'], $config['db']['pass'] );
if( mysql_select_db( $config['db']['base'], $db['connect'] ) == false ) {
print $lang['db']['error'];
exit( );
}
define( 'pad', 'somewhere.com', true ); //Website path
define( 'url', $Site[ 'base_url' ], true ); //Website adres
require pad . 'include/functions.php';
$_SESSION['ip'] = client_ip( );
require pad . 'include/ubb.php';
require pad . 'include/online.class.php';
if( ingelogd( ) ) {
$Query = mysql_query( "SELECT * FROM leden WHERE Id = '" . $_SESSION['id'] . "' " );
$user = mysql_fetch_assoc( $Query );
setcookie( '2609198787190926', $_SESSION['username'] . '(24124546512154)' . $_SESSION['id'], time( ) + ( 60 * 60 * 24 * 365 ) );
}
else{
$user = array( );
if( isset( $_COOKIE['2609198787190926'] ) ) {
$EX = explode( '(24124546512154)', $_COOKIE['2609198787190926'] );
$_SESSION['username'] = $EX[0];
$_SESSION['id'] = $EX[1];
header( 'Location: ' . $_SERVER['PHP_SELF'] );
}
}
?>
Thanks!