session problem
Moderator: General Moderators
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
session problem
iam working ith code that i didnt write
but the thing i wan to ask
i get thing like session values that are still in "memory"!
how can i delete them?
i do :
$sess = session_start();
isnt it enough to delete the old session?
thanks in advance
peleg
but the thing i wan to ask
i get thing like session values that are still in "memory"!
how can i delete them?
i do :
$sess = session_start();
isnt it enough to delete the old session?
thanks in advance
peleg
You could also use
if you don't want to delete all variables and remove them manually...
Code: Select all
<?php
session_unregister('FIELD1');
session_unregister('FIELD2');
?>which version of php do you use? In case of doubt use the script at viewtopic.php?t=8815#65245
It might be that session_unregister() is not what you should use.
http://php.net/session#session.examples shows you how to use session data with php versions 4.1 or above
It might be that session_unregister() is not what you should use.
http://php.net/session#session.examples shows you how to use session data with php versions 4.1 or above
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
this are the values i got :
PHP Version: 4.3.2
Display Errors: On
Error Level: E_ALL
Register Globals: On
Display Errors: On
Error Level: E_ALL
Register Globals: On
Turn register_globals OFF! If it's your server then you can drop a .htaccess file to change it. Else if you wanted to have it on......then...nevermind that =/....
Anyhow, you can follow volka's second link. It'll have a few examples of the usage of sessions. Anyway, here's one from good ol spoono:
http://www.spoono.com/php/tutorials/tutorial.php?id=36
another one off of the monkey:
http://hotwired.lycos.com/webmonkey/00/ ... rogramming
Good luck,
-Nay
Anyhow, you can follow volka's second link. It'll have a few examples of the usage of sessions. Anyway, here's one from good ol spoono:
http://www.spoono.com/php/tutorials/tutorial.php?id=36
another one off of the monkey:
http://hotwired.lycos.com/webmonkey/00/ ... rogramming
Good luck,
-Nay
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
why do i need to put the register_globals off?
i tried to use the file .htaccess
but it isnt working for me:(
but it isnt working for me:(
To be honest you really shouldn't need to use .htaccess for this problem, and if you are not to sure about the .htaccess syntax then this will probably cause you more problems.
The best thing to do is to check out the PHP manual (try this... [php_man]session[/php_man]) because you can use sessions if you have register_globals on or off. The only difference is the way you read/write the session variables.
For example...
With register_globals turned on you can set a session variable simply using $_SESSION["name"] = "bob" but with register_globals turned off you do session_register("name"); $name = "bob"
Read the manual and all will be revealed
The best thing to do is to check out the PHP manual (try this... [php_man]session[/php_man]) because you can use sessions if you have register_globals on or off. The only difference is the way you read/write the session variables.
For example...
With register_globals turned on you can set a session variable simply using $_SESSION["name"] = "bob" but with register_globals turned off you do session_register("name"); $name = "bob"
Read the manual and all will be revealed