News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SSI.php and mkportal lil help

Started by Ride, August 18, 2005, 10:52:09 PM

Previous topic - Next topic

Ride

I started a thread at mkportal.it with no solution as of yet.  I'm sure someone here can shed some light.  Here's the problem.

Most functions from ssi.php work fine for me in mkportal. I put them in a block like this:

$content=implode("", file("http://localhost/forum/custom_page_with_ssi.php"));


The one function that doesn't work is <?php ssi_welcome(); ?>   Always shows me as a guest when I'm logged in (if i access the imploded page directly or in an iframe it shows the "welcome, member you have 1 message..." like it should.

My ultimate shoutbox shows up as if I was a guest too. I'm sure this is related. If I put it in an iframe, of course everything works.


What do you think is causing this in mkportal?  Other functions in SSI work just fine.  It's like it's not grabbing my cookie.  Thanks for any help.

[Unknown]

When you use file(), it's the server creating the request - the server sending cookies.  You need to include SSI.php and call the functions directly (not by URL) if you want the user to be authenticated.

-[Unknown]

Ride

Quote from: [Unknown] on August 19, 2005, 12:24:13 AM
When you use file(), it's the server creating the request - the server sending cookies.  You need to include SSI.php and call the functions directly (not by URL) if you want the user to be authenticated.

-[Unknown]

So calling to a file that includes SSI.php and a function isn't enough huh?

Ride

I think I'm doing what you are saying unknown.  I implode a php page that has the require SSI.php on line one and then a funtion in the content.  I don't think I'm quite following you here.

[Unknown]

Loading a PHP file by URL is different from loading it by PATH.  Let me explain:

file('http://www.example.org/SSI.php')

Means:
  • Open a connection to www.example.org.
  • Ask it for SSI.php.
  • Give me what it sends you.

    On the other hand, this:

    include('/path/to/SSI.php');

    Means:
  • Open the SSI.php file at that path.
  • Parse and run the PHP code it contains.

    If you do it BY URL, you are making a second request (as if PHP had a browser and was going there itself.)  This does not pass any cookies along with the request.  There's no way for SMF to know the user is logged in.  It just sees some guest.

    -[Unknown]

Ride

Quote from: [Unknown] on August 21, 2005, 06:37:14 AM
Loading a PHP file by URL is different from loading it by PATH.  Let me explain:

file('http://www.example.org/SSI.php')

Means:
  • Open a connection to www.example.org.
  • Ask it for SSI.php.
  • Give me what it sends you.

    On the other hand, this:

    include('/path/to/SSI.php');

    Means:
  • Open the SSI.php file at that path.
  • Parse and run the PHP code it contains.

    If you do it BY URL, you are making a second request (as if PHP had a browser and was going there itself.)  This does not pass any cookies along with the request.  There's no way for SMF to know the user is logged in.  It just sees some guest.

    -[Unknown]
Ahhhh, thanks for the great explanation!  I will try this.

Advertisement: