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
Cookie Path: /

do this and try again
OMG ... It doesn't work Confused When I put / at the Cookie Path setting I can't log out and the script at the website doesn't work.
Umm, why cant i see username when logged in? It just says: Hey, . And nothing more. Help please?
Has anyone had any luck with a basic login/logout script that works?

Heres what i am looking for:

I am looking for a login/logout form for my main web page pretty simple form
username .password. login (if not logged in) Logout ( if logged in) Welcome mybb username , maybe a remember me checkbox.

I would also like to hide content links and or pages until they are logged in many thanks ahead of time.
ok, this is getting beyond frustrating.

nothing anyone has suggested has fixed my errors.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
    define("IN_MYBB",1);
    chdir('/public_html/forums/c&c'); // path to MyBB
    require './global.php';
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Pupils Path News</title>
<meta name="keywords" content="" />
<meta name="Gestured" content="" />
<link href="default.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<!-- start header -->
<div id="header">
	<div id="logo"> 
		<a href="http://www.pupils-path.net/index.html"><img src="http://www.pupils-path.net/images/header.jpg"</img></a>
	</div>
	<div id="menu">
		<ul id="main">
			<li class="current_page_item"><a href="#">Home</a></li>
			<li><a href="http://www.pupils-path.net/news.html">News</a></li>
			<li><a href="http://www.pupils-path.net/members.html">Members</a></li>
			<li><a href="http://www.pupils-path.net/about">About Pupils Path</a></li>
		</ul>
	</div>
</div>
<!-- end header -->
	<!-- start page -->
	<div id="page">
		<div id="sidebar1" class="sidebar">
			<ul>
				<li>
					<h2>Clan Forum boards</h2>
					<ul>
						<li><a href="http://www.pupils-path.net/forums/c&c/index.php">Command & Conquer Clan Forums</a></li>
						<li><a href="http://www.pupils-path.net/forums/tz/index.php">Command & Conquer General Chat Forums</a></li>
					</ul>
				</li>
		</div>
		<!-- start content -->
		<div id="content">
			<div class="post">
				<h1 class="title"><a href="#">To All clan and forum Members,</a></h1>
				<div class="entry">Pupils path Command & Conquer Forums relocated, and clan announcement!!!!!!!!!!</p>
					The new links have now been added, and coming soon, there will be more games introduced to the clan!</br>
					you can post your suggestion for the clan expansion <a href="http://www.pupils-path.net/forums/c&c/forumdisplay.php?fid=32">Create a petition here</a>
				</div>
			</div>
				</div>
			</div>
		</div>
		<!-- end content -->
		<!-- start sidebars -->
		<div id="sidebar2" class="sidebar">
			<ul>
				<?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/c&c/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='/public_html/forums/c&c/index.php' />
					<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
					}
				?>
				<li>
					<form method="get" action="http://www.pupils-path.net/search.php">
						<table bgcolor="#FFFFFF" cellpadding="0px" cellspacing="0px">
							<tr>
								<td style="border-style:none;">
								<div style="background: url(http://www.pupils-path.net/images/roundbox.gif) no-repeat left top; padding: 0px; height: 22px;">
								<input type="text" name="zoom_query" style="border: none; background-color: transparent; width: 106px; padding-left: 5px; padding-right: 5px;">
								</div>
								</td>
								<td style="border-style:none;">
								<input type="submit" value="" style="border-style: none; background: url('http://www.pupils-path.net/images/searchbutton1.gif') no-repeat; width: 24px; height: 22px;">
								</td>
							</tr>
						</table>
					</form>
				</li>
			</ul>
		</div>
		<!-- end sidebars -->
		<div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
<div id="footer">
</div>
</body>
</html>

the error messages i get are:
Quote:Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/pupils/public_html/index.php on line 4

Warning: require(./global.php) [function.require]: failed to open stream: No such file or directory in /home/pupils/public_html/index.php on line 5

Warning: require(./global.php) [function.require]: failed to open stream: No such file or directory in /home/pupils/public_html/index.php on line 5

Fatal error: require() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/pupils/public_html/index.php on line 5

i have combed this thread and my server practically with a microscope to see what i have done wrong. My version is 1.4.9.

even when i enter the direct URL, i get the same error. it does not seem to recognise the path i entered: /public_html/forums/c&c

if anyone has any ideas, that would be greatly appreciated. To prevent website downtime, i have uploaded the original HTML file before i changed it to the .php file, so if you need to have a look for yourself, just click this link
chdir('/public_html/forums/c&c'); // path to MyBB

try to change the patch to mybb.
chdir('forums/c&c'); // path to MyBB

in my website this is working very good.
This is odd, I got this code to work with almost every version of MyBB (1.4.x)
(2009-11-06, 05:15 PM)Lokki Wrote: [ -> ]
chdir('/public_html/forums/c&c'); // path to MyBB

try to change the patch to mybb.
chdir('forums/c&c'); // path to MyBB

in my website this is working very good.

the path to the mybb installation is this:

public_html/forums/c&c/index.php

i renamed the "mybb" folder to c&c and installed that way

oh my god.
you are kidding me. i found the error.
i was adding the "/" to the front.

guh. i think after this ordeal, i will be spending a lot more time studying PHP.

ok. new issue. it redirects me to an invalid link. i am getting a page not found error, but it is not 404'ing(and i spent 20 minutes making my 404 page look cool)

also- one other thing. i have noticed that now i have changed the page to a .php file, all my tables and content has just up and disappeared.

oh. i found that issue. it was not the script, but a dodgy CSS <div> input

ok. my menu has now gone wandering off underneath the login script. wth is going on?
everytime i make an adjustment now, it gets thrown in some random place, totally not where i want it to be.

as an update- because of the degree at which the PHP script was messing up my index page, i have removed it until i can try and work out a more stable web page.
lol, so you are having problems with PHP odd, I ran multiple PHP scripts in my index and nothing ever happens I also ran PHP using SSI method and nothing went wrong.

A, you don't have to point the script to index.php of the forum.

<?php

    $fid = 4;
    $limit = 4;
    $forumpath = 'forums';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('./global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');

?>

I use this code to include News Script and Login script on my index.php file and it works just fine ^^

Also the problem is not in PHP, but in the way you style the design. I never had such problems with my code and the login form never broke anything. My advice make sure you used valid CSS classes and your CSS is valid also go over the code of the CSS and check for anything that might be causing this errors, what I can think of is padding classes, margin classes and float classes which can cause this issues.
(2009-11-07, 05:22 PM)Kyonko Wrote: [ -> ]lol, so you are having problems with PHP odd, I ran multiple PHP scripts in my index and nothing ever happens I also ran PHP using SSI method and nothing went wrong.

A, you don't have to point the script to index.php of the forum.

<?php

    $fid = 4;
    $limit = 4;
    $forumpath = 'forums';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('./global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');

?>

I use this code to include News Script and Login script on my index.php file and it works just fine ^^

Also the problem is not in PHP, but in the way you style the design. I never had such problems with my code and the login form never broke anything. My advice make sure you used valid CSS classes and your CSS is valid also go over the code of the CSS and check for anything that might be causing this errors, what I can think of is padding classes, margin classes and float classes which can cause this issues.

i checked that, and apart from the few (now unused) classes i built to engineer image opacity(which for some reason instantly invalidates anything i put it in- even when i simply copy and paste from the w3schools).

the only other thing i could think of is it is because i generally avoid approaching table building if i can help it- because when i try and do it to fit my general design, it explodes in my face, and the multiple test browsers i use generate tables very differently, so then i lose the organization of my page
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