2010-12-22, 07:17 AM
I have read through the thread on how to integrating the forum login by redirecting my main site login form to member.php. My original code was making use of session to keep track of users on my main. How do I change the code to make it look at the login cookie set by mybb and what are the cookies that mybb set upon logging in?
<?php
session_start();
if (!isset($_SESSION['userID'])) //if session is not set, userid will be set to public and login form will be displayed.
{
$_SESSION['userID'] = 'Public';
$userID = $_SESSION['userID'];
}
$userID = $_SESSION['userID'];
if ($userID === "Public")
{
?>
<div class="loginform">
<form id="loginForm" name="loginForm" method="post" action="forum/member.php">
UserID:
<input name="username" type="text" id="username" size="8" />
Password:
<input name="password" type="password" id="password" size="8" />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='http://www.datesyoumustknow.com'/>
<input type ="submit" name="Submit" value="Login" class="loginbutton" />
</form>
</div>
<?php
}
else
{
$userName = $_SESSION['userName'];
$userID = $_SESSION['userID'];
}
?>