|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Using Sessions
Hi there,
When I'm using cookies, I just set the cookie to any information I want: <? $loginUserName = $HTTP_POST_VARS[loginUserName]; setcookie ("CkUserName", $loginUserName, time()+14400, "/", ".myDomain.com",0); ?> then if I want to retrieve that cookie, I just call it: <? $CkUserName = $HTTP_COOKIE_VARS["CkUserName"]; echo "$CkUserName"; ?> This is just Great, but if I want to use sessions, cause so many programmers advice me to use sessions instead of cookies, so: Q. How can I convert the above 2 scripts, to use sessions instead of cookies? because I searched the php manual and I couldn't find the way. |
|
#2
|
|||
|
|||
|
RE: Using Sessions
If you want to change the way you have been programming using cookies you could use the following instructions:
script one: <?php $loginUserName = $HTTP_POST_VARS[loginUserName]; session_start(); $CkUserName=$loginUserName; session_register("CkUserName") ?> script two: <?php session_start(); //shows the value stored echo $CkUserName; ?> |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Using Sessions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|