MyBB Community Forums

Full Version: Forum Login/Register, Forum stats portal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What I'd like is a script that I could use to put a login/register bar on my website and a forum stats script that shows the forum stats.
Simulationcity Wrote:What I'd like is a script that I could use to put a login/register bar on my website and a forum stats script that shows the forum stats.
When you say "forum stats", what exact forum stats would you like to display? Also, what kind of page extension will the script go on? (html, php etc.)
On the file portal.php there is a line about Forum Stats I am working on the stats part by taking out the important code and placing it in empty file.

This is what I have so far:

<?php
 define("KILL_GLOBALS", 1);

// set the path to your forums directory here (without trailing slash)
$forumdir = "/";

// end editing

if(!chdir($forumdir) && $forumdir)
{
	die("\$forumdir is invalid!");
}
$templatelist = "portal_welcome,portal_welcome_membertext,portal_stats,portal_search,portal_whosonline_memberbit,portal_whosonline,portal_latestthreads_thread_lastpost,portal_latestthreads_thread,portal_latestthreads,portal_announcement_numcomments_no,portal_announcement,portal_announcement_numcomments,portal";

require "global.php";
require "inc/functions_post.php";
require "inc/functions_user.php";

global $settings, $theme, $templates;

// Get Forum Statistics
if($mybb->settings['portal_showstatsh'] != "no")
{
	$stats = $cache->read("stats");
	$threadsnum = $stats['numthreads'];
	$postsnum = $stats['numposts'];
	$membersnum = $stats['numusers'];
	if(!$stats['lastusername'])
	{
		$newestmember = "<b>no-one</b>";
	}
	else
	{
		$newestmember = "<a href=\"".$mybb->settings[bburl]."/member.php?action=profile&uid=$stats[lastuid]\">$stats[lastusername]</a>";
	}
	eval("\$stats = \"".$templates->get("portal_stats")."\";");
}
?>

But I get this error:

Quote:Warning: main(): open_basedir restriction in effect. File(./inc/init.php) is not within the allowed path(s): (/home2/simulati/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home2/simulati/public_html/forums/global.php on line 12

Warning: main(./inc/init.php): failed to open stream: Operation not permitted in /home2/simulati/public_html/forums/global.php on line 12

Warning: main(): open_basedir restriction in effect. File(./inc/init.php) is not within the allowed path(s): (/home2/simulati/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home2/simulati/public_html/forums/global.php on line 12

Warning: main(./inc/init.php): failed to open stream: Operation not permitted in /home2/simulati/public_html/forums/global.php on line 12

Fatal error: main(): Failed opening required './inc/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/simulati/public_html/forums/global.php on line 12

Suggestions?

I'm a n00b at php.
Okay, no problem. First, save that code you wrote, inside your forum directory (the same directory your forum is). Then let me know where the new file is located, and where you want your new page to be located in relation to your forum directory.
I've been trying for about 4 days to make a login banner for a website and I now get the banner and the links at the top and all the info at the bottom. I deleted some stuff and I get this:

Quote:Parse error: parse error, unexpected '\"', expecting '(' in /home2/simulati/public_html/forums/portallogin.php on line 114

[attachment=1682]
Search for:
eval "$welcome = ("$templates->get ("portal_welcome")")";
Replace with:
eval("\$welcome = \"".$templates->get("portal_welcome")."\";");