Session extracted from PhpBB

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
The Monkey
Forum Contributor
Posts: 168
Joined: Tue Mar 09, 2004 9:05 am
Location: Arkansas, USA

Session extracted from PhpBB

Post by The Monkey »

What is wrong with this program? It worked fine in one folder, however, I moved it over to another folder and -blam- it won't work.

Code: Select all

<?PHP
define('IN_PHPBB', true);
$site_root_path = '/home/yolegoma/public_html/';
 $phpbb_root_path2 = '.monkeyslair/';
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$loggedin = $userdata['session_logged_in'];
$username = $userdata['username'];
$uservisit = $userdata['user_lastvisit'];
$useremail = $userdata['user_email'];
$userwebsite = $userdata['user_website'];

	// $new_post = the number of posts since last visit
	$sql = "SELECT * FROM monkey_posts WHERE post_time >= $uservisit"; 
                        $result = mysql_query($sql); 
			$new_post = "0";
while($row = mysql_fetch_array($result)) {
	$new_post = $new_post + 1;
                        ?>
Now, even when I have it echo $username or any of the variables right inside that same script, it won't work. No userdata is being included. What did I inadvertantly change?

:(
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Code: Select all

$phpbb_root_path2 = '.monkeyslair/';
unless the folder is named '.monkeyslair' (with the leading period (.), then it should be:

Code: Select all

$phpbb_root_path2 = 'monkeyslair/';
Image Image
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

or

Code: Select all

$phpbb_root_path2 = './monkeyslair/';
:P
The Monkey
Forum Contributor
Posts: 168
Joined: Tue Mar 09, 2004 9:05 am
Location: Arkansas, USA

Post by The Monkey »

*embarrased look* That was merely a typo, the script I am using has the / instead of the . I'm very sorry.

However, I'm not sure what the problem is. I simply COPIED this script from /redesign to /newredesign, and it quit working. I dislike programming sometimes.

*sigh*
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

maybe you have some other dependancy on /redesign ?
The Monkey
Forum Contributor
Posts: 168
Joined: Tue Mar 09, 2004 9:05 am
Location: Arkansas, USA

Post by The Monkey »

The problem lied in the fact that I was, in this case of header.php, including all of the url:, I.E, http://www.mysite.com/newredesign/inclu ... ession.php. Simply removing the http://www.mysite.com/newredesign/ fixed the problem.

However, I need the full url for when my scripts lie in subdomains, which will be the case in two occasions. How do I work around this problem?
Post Reply