Page 1 of 1
sessions question
Posted: Fri Jun 13, 2003 4:56 pm
by m3rajk
how do i set my own variables and then access them?
is it simply:
session_register('variable');
and then to use it later, $new_variable=$_POST['variable'];
i also would like to know how to have them passed so that they won't show up in the url, without using forms on every page.. anyone have advice?
Posted: Fri Jun 13, 2003 5:01 pm
by daven
Check out this thread:
viewtopic.php?t=6521
Posted: Fri Jun 13, 2003 10:16 pm
by m3rajk
much better than the book and man pages. i might have been slightly off..
ok. what if i call a page with a function that's in a get variable, and i want to have sessions on in the background that control who it is.
i also want to prevent sessions from appearing in the page because i don't want people to see it and be able to adapt it to get privledges they shouldn't have, yet i want to keep it as userfirendly as possible.
i've notived that pages that get the little secure paage icon in ie and netscape can't have the back button used (at least all the ones i've seen) so i'd like to avoid not being able to use the back button.
does anyone have suggestions?
Posted: Sat Jun 14, 2003 4:39 am
by inn
you session thingy will work like this. in each page you want to enable session the best way is to start the session using session_start (); at the very beginning of the script. You can assign session vars using the superglobal array $_SESSION ie: by saying $_SESSION['myvariable'] = "myvalue"; or whatsoever.
in the proceding page you can initialize the session the same way as above and to use the variable that you require by some thing like say: echo $_SESSION['myvariable'];
thats it. about the browser back buttons you should look a bit into dhtml. i guess its controlled by javascript.