Jump to content


Photo

wierd


  • Please log in to reply
18 replies to this topic

#1 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 10 March 2006 - 11:11 AM

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

#2 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 11 March 2006 - 03:10 AM

*bump* ^__^

#3 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 11 March 2006 - 03:46 AM

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#4 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 11 March 2006 - 03:58 AM

i think it might be because the sessions arnt carrying over to the files.

is this a possibility?

#5 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 11 March 2006 - 04:22 AM

If you session is not initialized. That is just one of many possibilities.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#6 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 11 March 2006 - 04:33 AM

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.

#7 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 12 March 2006 - 10:10 AM

*bump* >_>

#8 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 12 March 2006 - 12:01 PM

Without seeing the code, I can't really be of any assistance here. Your problem is not specific enough.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#9 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 12 March 2006 - 12:17 PM

there is code everywhere i cant just show it!


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

#10 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 14 March 2006 - 10:23 AM

*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]

#11 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 15 March 2006 - 02:20 AM

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 ??

#12 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 15 March 2006 - 02:25 AM

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.

#13 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 15 March 2006 - 04:00 AM

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*****

#14 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 15 March 2006 - 05:27 AM

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#15 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 15 March 2006 - 01:09 PM

[!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) View Post[/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) View Post[/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) View Post[/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.

#16 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 16 March 2006 - 01:36 AM

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#17 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 16 March 2006 - 02:10 AM

[!--quoteo(post=355542:date=Mar 15 2006, 08:36 PM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 08:36 PM) View Post[/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).

#18 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 16 March 2006 - 09:20 PM

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.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#19 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 16 March 2006 - 11:25 PM

Again, relative paths NOT URLs. It does not process them the same.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users