FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » FudApi
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
FudApi [message #161707] Sun, 31 January 2010 12:28 Go to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I have setup a forum and am wanting to use the fudapi on my home page.

As of now, I have domain.com/forum as the home to my forum.

On domain.com/index.php I want to use include the fudapi.inc.php (which has already been configured to include GLOBALS.php). The problem I am having is my domain is on cloud hosting. Because of this, I have a ROOT folder (named web in this case) which is not . Inside this folder, I have a content folder(similar to www, htdocs, and public_html on other hosts) and I have create the FUDForum folder here to house the cache, errors, files, etc.

The content folder is where index.php and the forum directory lives. What is the best way to be able to include the anything inside the FUDForum directory without compromising security?
Re: FudApi [message #161709 is a reply to message #161707] Sun, 31 January 2010 13:47 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Not sure I understand the question. Isn't there just one way to do it - include('/path/to/include/file.php')?
Re: FudApi [message #161710 is a reply to message #161707] Sun, 31 January 2010 13:53 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Yes, but the problem is the index.php lies within the web/content directory (the directory that is opened when you go to domain.com) and the forums I want to include are in web/FUDForum. There is no way to include files in this directory.

In the index.php, I have tried include ('../FUDForum/scripts/fudapi.inc.php'); but it can't find it.

Is there a safe way to include these fudapi in a file that is not in the same directory as the FUDForum?
Re: FudApi [message #161712 is a reply to message #161710] Sun, 31 January 2010 14:11 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
If the relative path is valid and PHP can read the file you should be OK. Try to unlock the forum's files to see it it helps.
Re: FudApi [message #161714 is a reply to message #161712] Sun, 31 January 2010 14:42 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Still not working.. I was able to include the files now, but when i try to use a function from the api, it stops rendering the page where the function is called..

Is there a way i can see if the files have actually been included?

For example, I have the following code:
<?php 
include_once '../path/to/fudapi.inc.php';
include_once '../path/to/GLOBALS.php'; 
echo "Top poster: ". fud_fetch_top_poster()->alias ."\n";
?>


I put it in the content div of my page.. everything renders up until that code is called, then the loading of the page is stopped
Re: FudApi [message #161715 is a reply to message #161714] Sun, 31 January 2010 15:35 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Add the following debugging code to the script to see what's happening:

error_reporting(E_NOTICE | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
ini_set('display_errors', '1');
ini_set('display_startup_errors', 1);
Re: FudApi [message #161716 is a reply to message #161715] Sun, 31 January 2010 15:38 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
GLOBALS.php should be loaded first. The correct code will be:

<?php 
include_once '../path/to/GLOBALS.php';
include_once '../path/to/fudapi.inc.php';
echo "Top poster: ". fud_fetch_top_poster()->alias ."\n";
?>
Re: FudApi [message #161717 is a reply to message #161707] Sun, 31 January 2010 15:41 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I put in that code and nothing renders still.. quits when it hits that section of php code so I can't even get an error message
Re: FudApi [message #161718 is a reply to message #161707] Sun, 31 January 2010 15:44 Go to previous message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
WOW! sorry to take your time.. it was a stupid mistake on my part.. GLOBALS.php is in a directory named include.. i had includeS

Thanks for the help.. man, i feel stupid Embarassed
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Google Analytics Code?
Next Topic: Twitter integration?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 13 19:48:09 EST 2017

Total time taken to generate the page: 0.00855 seconds