Re: extern.php problem
http://www.pluriservices.net/test2.php
What's wrong with that?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 troubleshooting → extern.php problem
http://www.pluriservices.net/test2.php
What's wrong with that?
http://www.pluriservices.net/test2.php
What's wrong with that?
Now, Nothing, because as I just said, I've just modified exit replacing it with return. And it seems to work...
Do you think that this could cause a problem?
Thanks Rickard
Ludo
exit in an include will kill the php return will just end that file
why not try active_topics.php in my first post, try it and modify as you need.
active_topics.php is extracted from extern.php
use it as
include('./forum/active_topics.php');
it's work good in my site
I see the problem now. extern.php isn't supposed to be included "locally" so to speak. When included via a local path, the scripts is essentially cut&pasted into the source of whatever file it was included from. You don't that (that's why the inclusion of config.php fails). When included via an URL or via SSI, what we include is the actual output of the script. That's why exit() works just fine when included via URL/SSI and why it fails when including it directly through the local file system.
I will replace the calls to exit() with returns as it has no negative effects.
Thanks for the info Rickard.
So I replaced exit by return 3 times. That's good?
Do I have to do it with "exit('Bad request');" at the end of the file.
Ludo
extern,php is good from outside of site but internaly not good becuase every external include mean another connection to database, if i include "recent topic" and "last users" that mean 3 connection to db and 3 line in apache log file mean slowing the home page, we need "internal.php".
Ludo: No, nevermind that.
zaher: But if people have already made their own connection to the database, they probably know howto fetch a few topics from the database.
But if people have already made their own connection to the database, they probably know howto fetch a few topics from the database.
i am not understand?
Huh?
Sorry i am not good reader of english sentences,
i am talking about include php file in home page like
include('http://domian.com/forum/extern.php');
php will make another http connection and read it as browser then return included the results
include('/home/site/forum/include/internal.php');
use the same $db connection opened in home page when include and build a html table of recent file then showd in side of home page.
Yes, I understood what you meant by that. What I was trying to say was if someone knows enough about PHP and PunBB to be able to make their own database connection, they probably also know enough to be able to output e.g. recent discussions. I will however, consider your suggestion.
Ah, you mean, pepole who can made homepage by himself thay can made a "recent discussions", ok
I dont know if Ludo's problem was resolved but I'v been batteling the same issue for a long time with my server.
The server will simply not allow an include with parameters. So, I'v found a way around it with page scraping. Yes its dirty, but it works.
I looked here and came to a conclusion.
<?php
require_once(dirname(__FILE__).'/class_http.php');
$h = new http();
if (!$h->fetch("www.host.com/forum/extern.php?action=new&show=4&fid=14")) {
echo "<h2>There is a problem with the http request!</h2>";
echo $h->log;
exit();
}
echo $h->body;
?>
Its kind of going beyond and above what I needed but now I also have a page scraper to use at my disposal. I tried using a number of methods that all failed. But, a page scraper comes in handy every now and again.
PS: Page scrapers can be bad in the wrong hands. Don't spam with them.
my host (Dreamhost) messed with the way includes are handled, so I had to do it via CURL. and I swear I got this info from the forum..
<?php
$curl_handle = curl_init();
// Where should we get the data?
curl_setopt ($curl_handle, CURLOPT_URL, 'http://www.sadreminders.com/interaction/extern.php?action=active');
// This says not to dump it directly to the output stream, but instead
// have it return as a string.
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
// the following is optional, but you should consider setting it
// anyway. It prevents your page from hanging if the remote site is
// down.
curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);
// Now, YOU make the call.
$buffer = curl_exec($curl_handle);
// And tell it to shut down (when your done. You can always make more
// calls if you want.)
curl_close($curl_handle);
// This is where i?d probably do some extra checks on what i just got.
// Paranoia pays dividends.
print $buffer;
?>
Nice idea.
There is always ways around things you just have to be creative. Creativity took me a couple of weeks.
PunBB Forums → PunBB 1.2 troubleshooting → extern.php problem
Powered by PunBB, supported by Informer Technologies, Inc.