Sessions and links [message #175753] |
Sun, 23 October 2011 09:58 |
houghi
Messages: 45 Registered: September 2011
Karma: 0
|
Member |
|
|
I am not sure if what I want to do is a good solution.
I have currently something like:
if (isset($_GET['dir'])) {
$dir=($_GET['dir']) ;
} else {
$dir="$MAIN_DIR";
}
[...]
<a href="#?dir=/media/video/music">Music</a><br>
<a href="#?dir=/media/video/movies">Movies</a><br>
This works and there is also no security risk, as the site is only
accesible by me.
However in learning I would like to get rid of the parameter in the URL.
Now I can just edit the URL to e.g. dir=/home and be there. To avoid
this I was thinking of using something like:
$_SESSION['dir'] = '/media/video/music' ;
I am unable to find how I could put this in the link and all searches
point me in the direction of using $_GET which is much easier.
Is there a way to do this or should I not be botherd and keep using
$_GET ? I rather not use cookies as they are client side and I would
want to use the same information from different PCs.
As extra information, I also have other parameters next to ?dir on that
page. Some 20 in total.
houghi
--
This is written under the inluence of the following:
> Artist : Theatre Of Tragedy
> Song : Ashes and dreams
> Album : Storm
|
|
|
Re: Sessions and links [message #175754 is a reply to message #175753] |
Sun, 23 October 2011 10:41 |
houghi
Messages: 45 Registered: September 2011
Karma: 0
|
Member |
|
|
houghi wrote:
> Is there a way to do this or should I not be botherd and keep using
> $_GET ? I rather not use cookies as they are client side and I would
> want to use the same information from different PCs.
I just realized that $_SESSION is also client based. Silly me. So
perhaps cookies is a solution. Mmm.
houghi
--
This is written under the inluence of the following:
> Artist : theatre of tragedy
> Song : a rose for the dead
> Album : fragments
|
|
|
Re: Sessions and links [message #175766 is a reply to message #175754] |
Sun, 23 October 2011 17:43 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
houghi wrote:
> houghi wrote:
>> Is there a way to do this or should I not be botherd and keep using
>> $_GET ? I rather not use cookies as they are client side and I would
>> want to use the same information from different PCs.
>
> I just realized that $_SESSION is also client based. Silly me. So
> perhaps cookies is a solution. Mmm.
>
> houghi
three mechanisms exist to introduce statefullness to HTML
Post variables, get variables and cookies.
|
|
|