I've inserted the code for the user control panel thingy. The code works, BUT!, I get this error:
Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/manne/public_html/p_index.php on line 10
I checked what is on line 10 which is the following:
define("IN_MYBB", 1);
It's part of a code that's being used to retreive posts as news items on my website.
So the main website code looks like this:
<head>
<script>
function submitted()
{
setTimeout("refresh()",6000);
}
function refresh()
{
var sURL = unescape(window.location.pathname);
window.location.href = sURL;
}
</script>
<link rel="stylesheet" href="tangodown.css">
etc. etc. until
[/head]
<?php
$rel = "forum/"; // The directory to your forum--relative to this file's location; include ending slash
chdir($rel);
define('IN_MYBB', 1);
require("./global.php");
?>
Now I'm using this together with a different news post-retreive thing which uses the following code (p_index.php):
<?php
$fid = 2;
$limit = 5;
$forumpath = 'forum/';
chdir($forumpath);
define("IN_MYBB", 1);
require('./global.php');
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
chdir('../');
?>
<span class="forumtext">
<?php
$query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");
if($db->num_rows($query) > 0)
{
while($row = $db->fetch_array($query))
{
$query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");
$row2 = $db->fetch_array($query2);
$date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
$time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);
$options = array(
'allow_html' => 'no',
'filter_badwords' => 'yes',
'allow_mycode' => 'yes',
'allow_smilies' => 'yes',
'nl2br' => 'yes',
'me_username' => 'yes'
);
$message = $parser->parse_message($row2['message'], $options);
echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['subject']}</a> <br />");
echo("Door <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a> op {$date}");
echo("<br /><br />");
echo("{$message}<br /><br />");
echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']} Reacties</a>");
echo("<hr />");
echo("<br /><br />");
}
}
else
{
echo 'Nothing to display.';
}
?>
Could it be that the combination of these scripts create the error? I thought it might be because 2 times the code defines IN_MYBB but deleting one row doesn't work..