[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-24-2005, 10:04 AM   #1 (permalink)
NamePros Regular
 
Join Date: Oct 2004
Posts: 317
5.91 NP$ (Donate)

benc811 is a jewel in the roughbenc811 is a jewel in the roughbenc811 is a jewel in the rough


changing directory

I am trying to write a script that needs to find info in another directory of the server i.e. http://www.here.com/this/mainfile.php needs to find files in http://www.here.com/other/findthis.inc anyone know what i should put i have tryed just writing out the address but it cant find it. should I CHMOD the .inc file?
__________________
benc811 is offline  
Old 12-24-2005, 10:33 AM   #2 (permalink)
NamePros Regular
 
gamex's Avatar
 
Join Date: Feb 2004
Location: Student @ UConn
Posts: 408
73.95 NP$ (Donate)

gamex has a spectacular aura aboutgamex has a spectacular aura about


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');
__________________
Joe
CarrotCash.com
gamex is offline  
Old 12-24-2005, 10:42 AM   #3 (permalink)
NamePros Regular
 
Join Date: Oct 2004
Posts: 317
5.91 NP$ (Donate)

benc811 is a jewel in the roughbenc811 is a jewel in the roughbenc811 is a jewel in the rough


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?
__________________
benc811 is offline  
Old 12-24-2005, 10:43 AM   #4 (permalink)
Eating Pie
 
iNod's Avatar
 
Join Date: Nov 2004
Location: Canada
Posts: 2,289
126.05 NP$ (Donate)

iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of

Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Or you can use

PHP Code:
chdir("../directory");
iNod
__________________
I feel old.
iNod is offline  
Old 12-24-2005, 10:47 AM   #5 (permalink)
NamePros Regular
 
gamex's Avatar
 
Join Date: Feb 2004
Location: Student @ UConn
Posts: 408
73.95 NP$ (Donate)

gamex has a spectacular aura aboutgamex has a spectacular aura about


Yea, you can PM me the code, or it would probably be better to post it here so everyone can see it
__________________
Joe
CarrotCash.com
gamex is offline  
Old 12-24-2005, 11:33 AM   #6 (permalink)
NamePros Regular
 
Join Date: Oct 2004
Posts: 317
5.91 NP$ (Donate)

benc811 is a jewel in the roughbenc811 is a jewel in the roughbenc811 is a jewel in the rough


Ok well here is the first page that gets called
PHP Code:
<?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 Code:
<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.
__________________
benc811 is offline  
Old 12-24-2005, 01:48 PM   #7 (permalink)
NamePros Regular
 
gamex's Avatar
 
Join Date: Feb 2004
Location: Student @ UConn
Posts: 408
73.95 NP$ (Donate)

gamex has a spectacular aura aboutgamex has a spectacular aura about


So you want to replace that last line with something like this?:

PHP Code:
<div align="center"><?php include('../forums/mods/phpbb_fetch_all/examples/portal.php'); ?></div>
__________________
Joe
CarrotCash.com
gamex is offline  
Old 12-24-2005, 02:10 PM   #8 (permalink)
NamePros Regular
 
Join Date: Oct 2004
Posts: 317
5.91 NP$ (Donate)

benc811 is a jewel in the roughbenc811 is a jewel in the roughbenc811 is a jewel in the rough


I want to change $phpbb_root_path so that I can move portal.php into a different directory .../newATW/ to be exact.
__________________
benc811 is offline  
Old 12-24-2005, 02:28 PM   #9 (permalink)
Eating Pie
 
iNod's Avatar
 
Join Date: Nov 2004
Location: Canada
Posts: 2,289
126.05 NP$ (Donate)

iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of

Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Where it says
PHP Code:
$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 Code:
$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.
__________________
I feel old.
iNod is offline  
Old 12-24-2005, 02:33 PM   #10 (permalink)
NamePros Regular
 
Join Date: Oct 2004
Posts: 317
5.91 NP$ (Donate)

benc811 is a jewel in the roughbenc811 is a jewel in the roughbenc811 is a jewel in the rough


Yea I know all that but the forum is in /forums/ Its right here http://www.annoytheworld.com/forums/portal.php
__________________
benc811 is offline  
Old 12-24-2005, 03:35 PM   #11 (permalink)
Eating Pie
 
iNod's Avatar
 
Join Date: Nov 2004
Location: Canada
Posts: 2,289
126.05 NP$ (Donate)

iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of

Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
So you want to move portal.php to
http://www.annoytheworld.com/newATW/portal.php

Forums are at
http://www.annoytheworld.com/forums/

Correct?

iNod
__________________
I feel old.
iNod is offline  
Old 12-24-2005, 03:42 PM   #12 (permalink)
NamePros Regular
 
Join Date: Oct 2004
Posts: 317
5.91 NP$ (Donate)

benc811 is a jewel in the roughbenc811 is a jewel in the roughbenc811 is a jewel in the rough


exactly
__________________
benc811 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Greatest Image Gallery Tutorial Ever Wybe Webmaster Tutorials 5 12-20-2005 10:51 AM
Directory Hand-Submission service. kektex For Sale / Advertising Board 2 06-15-2005 02:01 PM
public_html redhippo Web Design Discussion 8 02-27-2005 12:47 PM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 12:29 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85