FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Sessions and links
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Sessions and links [message #175753] Sun, 23 October 2011 09:58 Go to next message
houghi is currently offline  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 Go to previous messageGo to next message
houghi is currently offline  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 Go to previous message
The Natural Philosoph is currently offline  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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PHP Extension Namespaces
Next Topic: Giveaway: CodeLobster PHP IDE Professional edition
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 21:16:24 GMT 2024

Total time taken to generate the page: 0.05000 seconds