Re: SESSIONS and include()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PROBLEM SOLVED!

Hi and thanks for all your input and help.

I solved the problem. There was one little thing I just didn't think about.

What I actually did was include a variable (include($page)) and let the last page the user was on send a value for $page. Now, the pages I wanted to include, I included to different pages in different folders/directories so the variable $page was actually set to the full URL of the page to avoid confusions. But apearantly PHP drops all $_SESSION variables when inluding a full URL. Even when the URL-home is idetical to the page the user are on... Relative paths like $page="../folder/thispage.php" works fine when including $page.




Luis Moreira wrote:

Actually it does not make that much sense.
I use includes, with PHP extension, and never had a problem.
Take a look at how you communicate between modules, ergo if you have globals
on or off, the scope of variables, etc.
It seems as if "user_level" is not known within the module.

Luis

-----Original Message-----
From: Armando [mailto:dijital@xxxxxxx] Sent: quinta-feira, 9 de Fevereiro de 2006 4:41
To: php-windows@xxxxxxxxxxxxx
Subject: Re:  SESSIONS and include()

Read the user post (currently 2nd) from greatmagicalhat [at] gmail [dot] com at the link below. I've never tried including a php file myself so cannot verify their information, but it makes sense. When I use includes, I use a specific file extension and store the files in a protected directory (so they are not just able to be viewed by browsing directly to the file) and it works fine. If you do it with a different file extension, make sure you configure your web server to make PHP process pages with that extension. Cheers.

http://ca3.php.net/manual/en/function.include.php

Armando

Fredrik Tillman wrote:
Hi

PROBLEM:

I want to let certain users use certain funcions on my page. To manage that I start a session and define $_SESSION[user_level] to a value from a mySQL table. So far so good. Users with $_SESSION[user_level]=="1" can access things on the .php page they are on. I made a simple if-statement to handle that.

Now the problem is that i want to use include("page.php") and let the users with user_level=1 access special things on that included page. The if statements that let them change things work if I access the page directly from my browser but not when it is included in that main page.

Whats am I missing?



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux