News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Inlcude SSI.php on different subdomain

Started by Pewpew, November 09, 2010, 11:12:09 AM

Previous topic - Next topic

Pewpew

Hi everyone, first i would like to start with that: I am really really sorry if the question is already answered somewhere. I searched for topics and i could find only that one. I checked both google and the forum search (on simplemachines.org), this was the only piece of information i was able to find. The main reason is that im not sure what to look for (im having hard time defining the problem correctly).

I checked the documentation and the examples for ssi.php, but i couldnt find a way to solve my problem:

The forum is on a different subdomain so i can not include ssi.php using relative path.

The forum is on forum.sitename.com (sitename - example)
and the site is on hxxp:sitename.com [nonactive]

I dont have full access to the ftp server as we are using a hosting company. So i need a way to include ssi.php on my main page using absolute path (or something else). The solution given in the topic i found (linked above) is this:
implode('', file('http://www.yoursite.com/forum/SSI.php?ssi_function=recentTopics'));

Where should i put this? Instead of
<?php
include("http://www.domain.com/forum/SSI.php");
ssi_recentPosts($num_recent = 20, $exclude_boards = array(), $output_method = 'echo')
?>


it should be

<?php
implode
('', file('http://www.yoursite.com/forum/SSI.php?ssi_function=recentTopics'));
ssi_recentPosts($num_recent = 20, $exclude_boards = array(), $output_method = 'echo')
?>


..or not?
In my case i'll use the login/logout functionality of ssi.php (i need to integrate my forum users database into my site and use it for login there) so thats just an example.


Again, im really sorry that im starting a new topic (i really hate when some dumb*** decides to post a new one on his first day in a community), but i really have no choice. I just cant deal with this problem for quite some time.



Thanks in advance (and sry about my dumb forum name but everything i tried wasn't available).
:)

Oldiesmann

Including files by URL only works if your host has the allow_url_include option enabled in PHP. I believe that option is disabled by default (for security reasons).

You should still be able to include it the normal way unless your host has some strange setup that prevents files in the main domain's directory from accessing those on a subdomain.

Normally you would just do something like this:

<?php
include('/path/to/forum/SSI.php');
ssi_recentPosts(20);
?>
Michael Eshom
Christian Metal Fans

Pewpew

Quote from: Oldiesmann on November 09, 2010, 11:16:45 AM
Including files by URL only works if your host has the allow_url_include option enabled in PHP. I believe that option is disabled by default (for security reasons).

You should still be able to include it the normal way unless your host has some strange setup that prevents files in the main domain's directory from accessing those on a subdomain.

Normally you would just do something like this:

<?php
include('/path/to/forum/SSI.php');
ssi_recentPosts(20);
?>


1. Thanks!!! I expected the topic to die with no answers for several days =))
2. Can you tell me about the way to include files by url? I know that the example/solution above (in the OP) isnt correct, but i cant seem to find the way to do it.
I may be able to ask the host if its enabled / if he can enable it (not sure if its possible to do it only for one user, im not really familiar with that stuff).
3. In other words if everything else fails (2.) i should ask them about the direct path to the forum? The strange thing is, that i have different login credentials for the forum and the site (when connecting via FTP). And i guess that the forum isnt in a subdirectory under the site (in relation to index.php etc).

:( this will be harder than i thought.

Illori

do you have a cpanel? when you log into the ftp client in the cpanel it should show you the path to your files on the server, which should be what you are putting in your script. For security I would not want to include files by url enabled on my server so others could possibly use my files on another server.

Pewpew

Quote from: Illori on November 09, 2010, 11:39:10 AM
do you have a cpanel? when you log into the ftp client in the cpanel it should show you the path to your files on the server, which should be what you are putting in your script. For security I would not want to include files by url enabled on my server so others could possibly use my files on another server.
Thanks for the advice. No cpanel for the users, only administrators have accounts for it (i checked 1 week ago, executing scripts remotely is prohibited so i had to go through massive sh** to do anything with my sql db). But i will ask the guy that was helping me to check the server path.

xenovanis

You should be able to find the path to SMF in Admin -> Server Settings.
"Insanity: doing the same thing over and over again and expecting different results."

Pewpew

<?php
include('/path/to/forum/SSI.php');
ssi_recentPosts(20);
?>


I obtained the information i needed (file path @ the server). Mmm so how do i do this ... i know how to link stuff in htm but how is it working with ssi when the forum isnt 'under' the site?

server.domain/httpstuff/forum
server.domain/httpstuff/site

:dumb: / :confused:

Illori

were you given a path something like /home/yourdomainnamehere/public_html/yourrootfolder/yourforum? that is the path you put in the include for ssi.php.

Pewpew

Quote from: Illori on November 11, 2010, 05:37:28 AM
were you given a path something like /home/yourdomainnamehere/public_html/yourrootfolder/yourforum? that is the path you put in the include for ssi.php.
Damn, you're right - i overlooked things when i wrote my previous post as i was in a hurry. I'll check it when i get back home. Thanks :)

Pewpew

Thanks alot to everyone that helped me with this. Everything is (almost) working fine. The only thing that actually confused me was the redirecting after login/logout

<?php
require_once('/path/to/forum/SSI.php');
$_SESSION['login_url'] = 'http://yoursite.com' . $_SERVER['PHP_SELF'];
$_SESSION['logout_url'] = 'http://yoursite.com' . $_SERVER['PHP_SELF'];
?>


I used this but i added /authenticate.php at the end of the url. Actually i had to remove it and just use hxxp:yoursite.com [nonactive] so its perfect now.

Agian, thanks alot for the help and the support. I expected things to go alot worse with people throwing stuff at me.

o7

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Advertisement: