Jump to content

Archived

This topic is now archived and is closed to further replies.

saiko

wierd

Recommended Posts

im buildin a skining system into a memberystem and when the user logs in it declares variables.

one of them is $_SESSION['logged_in'] and if it is set then it does wateva else it will echo that there not logged in.

now it wont pick up the variable.

i have to include the users choice of skin if there logged in else it will include another.

on the skin it includes a file that if logged in will display links else display the login form.

it displays the login form when there logged in instead of the links.


any ideas?


btw my msn is saiko[at]final-designs[dot]com

Share this post


Link to post
Share on other sites
Not without seeing your code could I tell you where you messed up. I can tell you some of the possibilities, but not the definite solution.

Share this post


Link to post
Share on other sites
i think it might be because the sessions arnt carrying over to the files.

is this a possibility?

Share this post


Link to post
Share on other sites
If you session is not initialized. That is just one of many possibilities.

Share this post


Link to post
Share on other sites
they are initialized and i have session_start(); at the start of everything that needs it.

its like the sessions arnt carrying over to skin pages.

it works other pages like the usercp etc.

Share this post


Link to post
Share on other sites
Without seeing the code, I can't really be of any assistance here. Your problem is not specific enough.

Share this post


Link to post
Share on other sites
there is code everywhere i cant just show it!


the session arnt being carried over to the other files!!

Share this post


Link to post
Share on other sites
*bump* also go here this guy is having the same problem!! [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=88157\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=88157[/a]

Share this post


Link to post
Share on other sites
i made a sorta break through!

i have this when including a file for the skining system.

on the index page i had include("$scripturl/sources/skin_foot.php");

i changed it to include("sources/skin_foot.php");

and now them files work all good and pickup the variables.

$scripurl = [a href=\"http://127.0.0.1/ms2;\" target=\"_blank\"]http://127.0.0.1/ms2;[/a]


can someone plz tell me wat is wrong with using the variable that is set to the url in front of /sources/skin_foot.php ??

i need to use variables in front of the files or else it wont work!! :S

shuld i use the full path eg. home/user/www/folder/sources/skin_foot.php ??

Share this post


Link to post
Share on other sites
127.0.0.1 is the loop back address...in other words, your computer is looking to itself for the files. Unless your computer is also the server, it will fail. Even if your computer is the server, it may fail...I've never tried using 127.0.0.1. Change it to the server name rather than that IP address.

Share this post


Link to post
Share on other sites
yeh the server is runnin on my comp cuz i do all my testing on it!!

so shuld i upload to my actual server and test it????

ok thanx to everyone that tried to help its workin when im using the full path!

****SOLVED*****

Share this post


Link to post
Share on other sites
just to clarify, hitman6003, the host name is based on the IP so 127.0.0.1 (the loop back address) references the local system and will work perfectly fine. If you check your hosts configuration "localhost" points to 127.0.0.1. Use either one they are one and the same. When you type in a domain name, such as google.com, your request is routed to a name server which in turn redirects you to the IP address of the server. Essentially, a domain name is an alias to the IP address that is easier to remember, but without a DNS you would be completely lost.

Glad to hear everything is working, saiko.

Share this post


Link to post
Share on other sites
[!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) [snapback]355231[/snapback][/div][div class=\'quotemain\'][!--quotec--]
the host name is based on the IP[/quote]

duh.

[!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) [snapback]355231[/snapback][/div][div class=\'quotemain\'][!--quotec--]
so 127.0.0.1 (the loop back address) references the local system[/quote]

hence the, quite logical, name "Loop back address"

[!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) [snapback]355231[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you check your hosts configuration "localhost" points to 127.0.0.1. [/quote]

He is returning 127.0.0.1 to the browser however, so it won't do a dns lookup. And once it goes to the browser, the server has no control over it. The server isn't actually sending an img when you put in an img tag...it sends the location of the image, which the browser then goes and retrieves from that location.

Putting 127.0.0.1 as the address will cause the browser to automatically go to localhost...so if he looks at the page from anywhere but his computer, it won't display correctly.

Share this post


Link to post
Share on other sites
Now if he is looking for the server (his computer) from his computer and he uses the loopback address which points to his computer. Gee, why do you suppose that would not work? Could it be because the include statement looks at relative paths not fully qualified URLs? He wasn't trying to reference an image in any way, he was trying to do an include(). DNS has nothing to do with the server, but everything to do with the request the browser sends to the name server. If you want to be a jerk about something when someone explains something you seem to not understand, then go waste someone else's time.

Share this post


Link to post
Share on other sites
[!--quoteo(post=355542:date=Mar 15 2006, 08:36 PM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 08:36 PM) [snapback]355542[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you want to be a jerk about something when someone explains something you seem to not understand, then go waste someone else's time.
[/quote]

Sorry, didn't think I was.......

But, I digress.

I think that the problem may be that the [a href=\"http://127.0.0.1/ms2/\" target=\"_blank\"]http://127.0.0.1/ms2/[/a] may not be the same directory as what you are trying to include.

Typing [a href=\"http://127.0.0.1\" target=\"_blank\"]http://127.0.0.1[/a] into your browser window, assuming that you are logged into the server, is the same as typing [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a], or if you are on a different computer, [a href=\"http://servername/\" target=\"_blank\"]http://servername/[/a].

So, if you use [a href=\"http://127.0.0.1\" target=\"_blank\"]http://127.0.0.1[/a] in an include, your telling it to look to the document root for your files. Putting the /ms2/ after it tells it to look in the ms2 folder. So the full include path would, using the var string $scripturl/sources/skin_foot.php would be "http://127.0.0.1/ms2/sources/skin_foot.php". So if your files are not in the /ms2/sources/ folder, then it won't find them. Changing that include to use "sources/skin_foot.php" tells it to look from the current directory. So if your in the ms3 directory, for example, you would need to use "http://127.0.0.1/ms3/"

Assuming you knew that, another problem could be permissions. When you use the ip like that I would think that it treats it the same as if it's pulling a url from some other random server, which your server may not accept connections in that way, or it may not be configured to retrieve files from a url. Or that particular directory may not allow files to be retrieved in that manner.

Either way, I wouldn't use that particular method. I would use the relative path, wether from the current diretory (./ for current, ../ for one up, ../../ for two up, etc) or from the document root (/foldername).

Share this post


Link to post
Share on other sites
using URL format (i.e. http://) for includes is just like opening up another webpage through a broswer. if the configuration of session cookies is set to yoursite.com, then they're only available to yoursite.com, not 127.0.0.1 or myotherdomain.com, etc. Also, I believe the php engine cannot store cookies so that may be another reason why the session variables aren't available to the skins. however, using relative path or absolute path for includes ignores the domain name issue and treat the including pages as a part of the same webpage, so the sessions work.

Share this post


Link to post
Share on other sites
Again, relative paths NOT URLs. It does not process them the same.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.