Unstoppable Domains

Changing directory thread

Spaceship Spaceship
Watch

benc811

Established Member
Impact
4
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
Well, are you going to include the file? You can use the full path, like

/home/username/public_html/other/findthis.inc

or do something like

include('../other/findthis.inc');
 
0
•••
Well I am including a php file that then includes its own files and finds if a user is logged in or not. If not then it displays a login form. The file works fine on its own and shows the login form when logged out and text if logged in. But when I include it into the new page it always displays the log in form even when logged in. Maybe I asked the worng question before.

Can I pm you all the code I cant seem to figure out the problem?
 
0
•••
Or you can use

PHP:
chdir("../directory");

iNod
 
0
•••
Yea, you can PM me the code, or it would probably be better to post it here so everyone can see it
 
0
•••
Ok well here is the first page that gets called
PHP:
<?php

$phpbb_root_path = '';

define ('IN_PHPBB', true);

if (!file_exists($phpbb_root_path . 'extension.inc'))
{
    die ('<tt>
          $phpbb_root_path is wrong.</tt>');
}

//
// phpBB related files
//

include_once ($phpbb_root_path . 'extension.inc');
include_once ($phpbb_root_path . 'common.' . $phpEx);
include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx);

//
// Fetch All related files - we do need all these because the portal is a
// huge example
//

include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/stats.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/users.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/polls.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/forums.' . $phpEx);

//
// start session management
//

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

//
// since we are demonstrating span pages we need to set the page offset
//

if (isset($HTTP_GET_VARS['start']) or isset($HTTP_POST_VARS['start']))
{
	$CFG['posts_span_pages_offset'] = isset($HTTP_GET_VARS['start']) ? $HTTP_GET_VARS['start'] : $HTTP_POST_VARS['start'];
	if (!intval($CFG['posts_span_pages_offset']))
	{
		$CFG['posts_span_pages_offset'] = 0;
	}
}

// fetch new posts since last visit
$new_posts = phpbb_fetch_new_posts();

// fetch user online, total posts, etc
$stats = phpbb_fetch_stats();

// fetch online users
$online = phpbb_fetch_online_users();

// fetch five users by total posts
$top_poster = phpbb_fetch_top_poster();

// fetch a random user
$random_user = phpbb_fetch_random_user();

// fetch forum structure
$forums = phpbb_fetch_forums();

// fetch a poll
$poll = phpbb_fetch_poll();

// fetch a single topic by topic id
// You will need to specify a certain topic id to use this function.
// The first post of that topic will be displayed in a box to the upper right.
#$topic = phpbb_fetch_topics();

// fetch latest postings
$CFG['posts_trim_topic_number'] = 25;
$recent = phpbb_fetch_posts(null, POSTS_FETCH_LAST);

// fetch postings
$CFG['posts_trim_topic_number'] = 0;
$CFG['posts_span_pages']        = true;
$news = phpbb_fetch_posts();

//
// disconnect from the database
//

phpbb_disconnect();

?>
<div align="center">
<!-- USER logged in-->
<?php if ($userdata) { ?>
<?php if ($userdata['session_logged_in']) { ?>
you are logged in<br>
<a href="<?php echo append_sid($phpbb_root_path . 'privmsg.php?folder=inbox'); ?>"><?php
if ($userdata['user_new_privmsg'] == 0) {
echo $lang['No_new_pm']; }
elseif ($userdata['user_new_privmsg'] == 1) {
echo printf($lang['New_pm'], $userdata['user_new_privmsg']); }
else {
printf($lang['New_pms'], $userdata['user_new_privmsg']); }
?></a>
<?php }
} ?>
<!-- USER logged in-->

<!-- LOGIN -->
<?php if (!$userdata or !$userdata['session_logged_in']) { ?>
<form action="http://www.annoytheworld.com/forums/login.php" method="post" target="_top">
<input type="text" name="username" size="20" maxlength="40" value="Username" /><br /><br>
<input type="text" name="password" size="20" maxlength="25" value="Password" /><br /><br>
<input type="hidden" name="sid" value="<?php echo $userdata['session_id']; ?>" />
<input type="hidden" name="outside" value="1" />
<input type="submit" class="mainoption" name="login" value="Login" />
</form>
<?php } ?>
<!-- LOGIN -->
</div>
This can be seen here


And For the page that calls it
PHP:
<div align="center"><?php include('http://www.annoytheworld.com/forums/mods/phpbb_fetch_all/examples/portal.php'); ?></div>
This can be seen here on the left panels the one with the login boxes.
 
0
•••
So you want to replace that last line with something like this?:

PHP:
<div align="center"><?php include('../forums/mods/phpbb_fetch_all/examples/portal.php'); ?></div>
 
0
•••
I want to change $phpbb_root_path so that I can move portal.php into a different directory .../newATW/ to be exact.
 
0
•••
Where it says
PHP:
$phpbb_root_path = '';

Replace the '' with where you want to put it..

If you want to put it in the directory newATW (/newATW) and have PHPBB in the root directory (/)

Change it to
PHP:
$phpbb_root_path = '../';

I did this off my head it may not work correctly if it doesn't I will fix it for you.

iNod.
 
0
•••
0
•••
0
•••
exactly
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back