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
No, the code on page 1 is not correct, as it doesn't define MyBB. There is a post a few pages back with the right code,

BP
Hey. I've got a problem now. I use this code to insert my Content into my site (brisingr.net).

<?php
$news = 'news.php';
$error = '404.txt';
$ext = '.html';

if(!isset($_GET['id'])){
include $news;
}
elseif($_GET['id'] == 'main') {
include $news;
}
elseif(isset($_GET['id']) && file_exists($_GET['id'].$ext)){
include $_GET['id'].$ext;
}
else{
include $error;
}
?>

But, when you go to a page with an address such as:
http://brisingr.net/?id=about

You get the 404 Error (404.txt).

I already know what's interfering. It's the:

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

(The code at the very top).

Question is, how do I fix this? Pleas helps, thx

~saul
Thanks for this tutoria! it works perfectly Smile
Now i just need a logout link, but i don't know how to get the session id...can anyone show me please?
Nevermind. I found it in a post by MrDoom.

This will give you the sid if anyone else wants to know
$session->sid
If someone can help me: I get a 404, from this line:
<form method="POST" action="/<?php echo $rel; ?>member.php">
The line above is on the 21st line, just so you know.

Out of:
<?php
$rel = "forum/";
chdir($rel);
require("./global.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<style type="text/css">
<!--
body {
	background-color: #3A3A3A;
}
-->
</style></head>
<body>
<table>
 <form method="POST" action="<?php echo $rel; ?>member.php">
  <input type="hidden" name="action" value="do_login">
  <tr>
   <td>Username</td>
   <td><input type="text" name="username" size="15"></td>
  </tr>
  <tr>
   <td>Password</td>
   <td><input type="password" name="password" size="15"></td>
  </tr>
  <tr>
   <td colspan="2"><center><input type="submit" value="Login" name="submit"></center></td>
  </tr>
  <tr>
   <td colspan="2"><center><A HREF="member.php?action=register" target="_blank">Not a member? Register now!</A></center></td>
 </form>
</table>
</body>
</html>
Any ideas?
will this code still work in 1.4?

<?php

define('IN_MYBB', 1);
chdir('../forum'); // path to MyBB
require './global.php';
?>
<HTML>
<?php

if($mybb->user['uid'] > 0)
{
  // The user is logged in, say Hi
echo "Hey, {$mybb->user['username']}.<br>
Thanks for logging in.";
}
else
{
  // The user is not logged in, Display the form
echo "<form action='efforums/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='http://www.yousite.com/' />
<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}
?>
</HTML> 
I think it should, I keep meaning to test it myself.
MrDoom Wrote:I think it should, I keep meaning to test it myself.

well i hope so as i am now starting to make my site forum systems now and i just do not want to have to rewrite the hole thing when i am done so it will work with 1.4.
Depending on how you wrote it, the changes would only be minor anyway.
OK I am trying to place this on my site. If I place it all by itself on a page it works without a problem. However, if I try to place it inside a web page I come up with the following error when not logged in.

Warning: Cannot modify header information - headers already sent by (output started at /home/journey/public_html/overhaul3.php:6) in /home/journey/public_html/petchat/inc/functions.php on line 1133

I am a little lost. Thank you in advance for any help you can give.

Adam Burgi
www.journeyoftheanimals.com
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