Re: extern.php problem

http://www.pluriservices.net/test2.php

What's wrong with that?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

27 (edited by Ludo 2004-10-25 20:40)

Re: extern.php problem

Rickard wrote:

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

Re: extern.php problem

exit in an include will kill the php return will just end that file

29 (edited by zaher 2004-10-25 23:24)

Re: extern.php problem

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

If your people come crazy, you will not need to your mind any more.

Re: extern.php problem

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.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

31 (edited by Ludo 2004-10-26 14:16)

Re: extern.php problem

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

32

Re: extern.php problem

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".

If your people come crazy, you will not need to your mind any more.

Re: extern.php problem

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.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

34

Re: extern.php problem

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?

If your people come crazy, you will not need to your mind any more.

Re: extern.php problem

Huh?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

36

Re: extern.php problem

Sorry tongue 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.

If your people come crazy, you will not need to your mind any more.

Re: extern.php problem

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.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

38

Re: extern.php problem

Ah, you mean, pepole who can made homepage by himself thay can made a "recent discussions", ok smile

If your people come crazy, you will not need to your mind any more.

39

Re: extern.php problem

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.

-gezz

40 (edited by lament 2006-01-13 07:24)

Re: extern.php problem

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;

?>

41

Re: extern.php problem

Nice idea.

There is always ways around things you just have to be creative. Creativity took me a couple of weeks.

-gezz