MyBB Community Forums

Full Version: Integrating MyBB into your website. (Login Form)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Then you probably shouldn't use it.
(2009-07-05, 12:14 AM)xiofire Wrote: [ -> ]I have a simple problem.
No matter if I'm logged in or out on the forum, it always seems to show the form. I've done everything perfectly as described.
I'm not a PHP noob and I have tried different approach and fixes to this problem, none seem to work. :s

what are your cookie settings?
Hello,

After including 'global.php' none of the other relative path inclusion don't work, and the php code breaks, absolute path inclusions work fine. Is it just me, or is it something in 'global.php' ?

[Image: pokit49c9adb18e44be0711a94e827042f630.png]

Inclusion code...

[Image: pokit31b3b31a1c2f8a370206f111127c0dbd.png]

HTML breaks right there...

[Image: pokitdabd8d2ce74e782c65a973ef76fd540b.png]

Any ideas? Thanks.
did you used chdir?
HEY! I say I don't understand, because I don't spek english very well, and I don't know PHP, so please, Anybody could explain me?
it's a login form for your website.
if you have a website and a forum you can login on the forums using the website.
How Can I use that?
Please, I need it
thanks alot I will try it a.s.a.p.
Hey, once i get the confirmation message for the login, it logs in the username on the my forum, but when i head back to the login form, it asks me for my login information.

EDIT:
I figured it out, it was a cookie problem.
Ok, so I have the following on the index page of my website. If I login using the form on the front page. It logs me into the forums, but if I go back to the main page I am shown with the login form again.


chdir('forums'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';




if($mybb->user['uid']){
	// The user is logged in, say Hi
	echo 'Hey, '.$mybbuser[username].'.<br>
	Thanks for logging in.';
}
else{
	// The user is not logged in, Display the form
	echo '<form action="forums/member.php" method="post">
		Username: <input type="text" name="username" size="25" maxlength="30" /><br />
		Password: <input type="password" name="password" size="25" />
		<input type="hidden" name="action" value="do_login">
		<input type="hidden" name="url" value="index.php" />
		<input type="submit" class="submit" name="submit" value="Login" /></form><br>';
}


I have it working a different way on another website of mine. When I moved it over it did the same thing. I was hoping this tutorial would fix it but I have come up with the same result.

The other way I have it is this:

define ("IN_MYBB",1);
$rel = 'forums/';
require $rel."global.php";

and

		if($_COOKIE['mybbuser'] != '')
		{
		
		$logged_in = 'true';	
		
		$username = stripslashes($_COOKIE['mybbuser']);
		$login_cookie = explode('_', $username);
		$check = mysql_query("SELECT * FROM `mybb_users` WHERE `uid` = '".$login_cookie['0']."' && `loginkey` = '".$login_cookie['1']."'");
		$check_num = mysql_num_rows($check);
		if ($check_num != '1')
		{	
			$past = time() - 100; 
			$logged_in = '';
			setcookie('mybbuser', gone, $past); 
			header("location: index.php");		
		}
		$check_again = mysql_query("SELECT * FROM `mybb_users` WHERE `uid` = '".$login_cookie['0']."'");
		while($info = mysql_fetch_array( $check_again ))
		{
			$logged_username = $info['username'];
			
		}
		}
	else
		{
			$logged_in = '';			
		}

Still coming up with the same result. I have a feeling its something wrong with the cookies but to be honest I have no experience with them at all. So if anyone can help me work this out I would appreciate it.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48