MyBB Community Forums

Full Version: Integration Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Does anyone know how to fix this?

Thanks.

Code:

<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '/path/to/mybb_forum/global.php';
require_once '/path/to/MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

if ($MyBBI->isLoggedIn() === false){
echo '<form id="myloginform" method="post" action="login.php">
<label>Username</label><input type="text" name="username" />
<label>Password</label><input type="password" name="password" />
<input type="submit" name="Login" />
</form>';

/* Was the submit button pressed? If so, do the login routine */
if (isset($_POST['Login'])){
$logmein = $MyBBI->login($_POST['username'], $_POST['password']);
if ($logmein == true) echo 'Logged in successfully';
else echo 'The login routine failed';
}
else{
echo 'Hello, ', $MyBBI->mybb->user['username'], '. You're already logged in.';
} 
?>

Error Message:

Parse error: syntax error, unexpected $end in /home/a3285398/public_html/login/login.php on line 24
I would suggest cleaning your code up a bit. You also didn't escape the ' in You're.

<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '/path/to/mybb_forum/global.php';
require_once '/path/to/MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

if ($MyBBI->isLoggedIn() === false){
	echo '<form id="myloginform" method="post" action="login.php">
	<label>Username</label><input type="text" name="username" />
	<label>Password</label><input type="password" name="password" />
	<input type="submit" name="Login" />
	</form>';

	/* Was the submit button pressed? If so, do the login routine */
	if (isset($_POST['Login']))
	{
		$logmein = $MyBBI->login($_POST['username'], $_POST['password']);
	}
	if ($logmein == true)
	{
		echo 'Logged in successfully';
	}
	else 
	{
		echo 'The login routine failed';
	}
}
else{
	echo 'Hello, ', $MyBBI->mybb->user['username'], '. You\'re already logged in.';
} 
?>

I cleaned it up a bit. Let me know if it works for you!
Thanks, it works!
+1 Rep!