Hi all,
Finally got this sorted! Thanks to everyone who replied.
I had to remove every bit of whitespace from all three files..
For those who are interested I have posted the (working) code below..
Thanks again..
index3.php
<?
include '../includes/header.php';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td class="left" width="114" height="22" align="left" valign="top"><? include '../includes/menu.php'; ?></p></td>
<td class="centrearea" width="598" align="left" valign="top">
<div id='middle'>
<p>Please login using your BlastBeat Login below:</p></h3>
<form action="login3.php" method="POST">
<table align="center" border="0">
<tr>
<th><div align="left">
Username:
</div></th>
<th>
<div align="left">
<input name="username" type="text" id="username">
<br>
</div></th>
</tr>
<tr>
<th>
<p align="left">Password<em> (case sensitive)</em>:</p>
</th>
<th>
<div align="left">
<input name="user_password" type="password" id="user_password">
</div></th>
</tr>
<tr>
<th colspan="2" align="right">
<div align="left">
<input type="submit" value="Submit">
</div>
</form>
<p> </p>
<p> </p>
</body>
</html>
login3.php
<?php
require_once( '../includes/PHPBB_login2.php');
include '../includes/connect_blast_phpbb.php';
session_start();
$username = $_POST['username'];
$user_password = $_POST['user_password'];
$user_password = md5($user_password);
$user = new User();
$user_id = $user->login( $username, $user_password );
if ($user_id !== -1)
{
// Then login the user to the forum
$phpbb = new PHPBB_Login();
$phpbb->login( $user_id );
//echo "User should be logged in";
header("Location: " . "../index.php");
}
else
{
echo "Login Failed";
}
?>
PHPBB_login2.php
<?php
// Define Your User class
// User has a method called login
class User
{
function login($username,$user_password)
{
// Authenticate the user
$sql = ("SELECT * FROM phpbb_users WHERE username='$username' AND user_password='$user_password'");
$result = mysql_query($sql);
$login_check = mysql_num_rows($result);
$contact = mysql_fetch_object ( $result );
// if user found
if($login_check > 0)
{
$user_id = $contact -> user_id;
return $user_id;
}
else
{
return -1;
}
}
}
class PHPBB_Login
{
function PHPBB_Login(){}
function login( $phpbb_user_id )
{
define('IN_PHPBB',true);
//You may need to change the following line to reflect
// your phpBB installation.
$phpbb_root_path = "../forum/";
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
// Setup the phpbb environment and then
// run through the phpbb login process
require_once( $phpbb_root_path . "config.php" );
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 )
{
define('IN_PHPBB',true);
// You may need to change the following line to reflect
// your phpBB installation.
$phpbb_root_path = "../forum/";
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( $phpbb_root_path . "config.php" );
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, " " );
}
}
?>