1
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/16 17:11

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


I've found this afternoon a solution. It's a question of "structure". For my explication, i have simplified the code.

Before, i made that:
for ($i=0$i<$nbvar,$i++) {
   
$_SESSION["var['contact'][$i]"]=$value1[$i];
   
$_SESSION["var['adresse'][$i]"]=$value2[$i];
}

//and for desrtroy

unset($_SESSION["var['contact']"]);
unset(
$_SESSION["var['adresse']"]);

// but that doesn't work


But now i do that:

for ($i=0$i<$nbvar,$i++) {
   
$var["$i"]['contact']=$value1[$i];
   
$var["$i"]['adresse']=$value2[$i];
}

$_SESSION['var']=$var;

//and for desrtroy

unset($_SESSION["var"]);

// and that work :-D



2
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/16 11:07

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


Quote:

m0nty wrote:
but can't you write a function that will grab the array data and use a foreach() to unset the returned values from the array?


If there isn't an other solution, i'll do that.



3
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/16 10:29

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


If I do unset($_SESSION['var']) on a simple variable, there's no problem in fact but if I do unset($_SESSION['var']) and "var" is an array (var[0],var[1],...), that doesn't work...



4
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/16 5:40

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


I've understood.

In case to simplify the explication, i didn't say that

unset($_SESSION['txt']);
unset($_SESSION['heure']);
unset($_SESSION['adresse']);
unset($_SESSION['contact']);

txt, heure, adresse, contact was array and apparently in XOOPS we can't destroy an array with this method.

We must destroy variable by variable.

unset($_SESSION['txt[0]']);
unset($_SESSION['heure[0]']);
unset($_SESSION['adresse[0]']);
unset($_SESSION['contact[0]']);
unset($_SESSION['txt[1]']);
unset($_SESSION['heure[1]']);
unset($_SESSION['adresse[1]']);
unset($_SESSION['contact[1]']);
...

How can I do to destroy the array as a whole ?



5
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/15 22:19

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


I suppose because it's in XOOPS et XOOPS uses session to test the right of the user. It's in the admin of the website my problem not in the member area...



[EDIT: 2006/10/16 7:33]

I've just tried to be sure. I've added "session_start();" but that send me an error.
" A session had already been started - ignoring session_start() in file (...)"

[/EDIT]



6
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/15 18:38

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


Yes but that doesn't work... unfortunately...


Here the copy/paste of some of my lines:
unset($_SESSION['txt']);
unset(
$_SESSION['heure']);
unset(
$_SESSION['adresse']);
unset(
$_SESSION['contact']);



7
hulk8
How destroy a variable in a session ?
  • 2006/10/15 15:38

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


Hi everobody,


I have a trouble with session in Xoops.
I'm creating a module for my website and I need to keep in stock several values in session. But I also need to destroy this values at a moment. How can I do that ?

I've tried with "session_unregister()" and "unset()" function but that doesn't work.

What must i do, it's rather complex so I can't do it with "POST" and "GET".


Somebody have an idea ?


Thanks a lot for your help,



PS: Sorry for my english but i can't speak english very well but I can read it without problem.



8
hulk8
Re: Xoops 1.3.8 to 2.0.9.2
  • 2005/3/16 20:28

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


It's working perfectly... thank you very much...




9
hulk8
Re: Xoops 1.3.8 to 2.0.9.2
  • 2005/3/16 15:03

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


Thanks.

I will try that this evening and I'll say you if it's work



10
hulk8
Xoops 1.3.8 to 2.0.9.2
  • 2005/3/16 14:51

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


Hello,

I've a problem. My website is powered by XOOPS 1.3.8. I didn't upgrade to 2.x XOOPS version because my modules wasn't compatibles. Now, i've developped some of news modules for my website, and i will upgraded my XOOPS to ne the last version (2.0.9.2). I suppose that i must apply the patch one by one 1.3.8 -> 1.3.9 -> 1.3.10 -> 2.0.0 -> ...
But on the web, i don't find all the patches that i need :
1.3.8 -> 1.3.9
1.3.10 -> 2.0.0
2.0.0 -> 2.0.3

Are there an another method to do that whitout lost my data ?


Thanks for your help,


Laurent



PS : Sorry for my english but i'm a french speaker and i speak vera bad english.




TopTop



Login

Who's Online

228 user(s) are online (151 user(s) are browsing Support Forums)


Members: 0


Guests: 228


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits