Well, I have asked a couple of questions on this list, but they havn't 
really helped alot. Maybe you can help?

My situation background is as follow:
I have always written my apps in the following way: register_globals=on, 
so I allowed PHP to "generate" my variables for me on the action page, 
and if I cannot use a form to "send" variables to the next pages, I 
added them manually to the url.
So, then I discovered sessions and thought my probelms were solved, only 
to discover that it uses cookies by default, and has to have the 
--trans-sid option compiled to have PHP handle the app if you don't want 
cookies ( like me, don't want cookies at all, or for that matter, 
anything that relies on the client's side). So, I couldn't just jump in 
and use sessions as I would not be sure that my app would work on any 
PHP4 system regardless of the options it was compiled with. ( Oh, I am 
writing my apps to work with register_globals=off now, so that shouldn't 
be a problem).
So I started to look for a way to code with sessions that will not 
require cookies nor require any special compile features; the answer 
came in adding <?=SID?> to all relative URL's in my app.
Alas, that is where I'm at, and it's still not working as I would have 
My problem is with the way my proposed app works/should work.

I am trying to write an app that allows the user to log in, then 
add/remove projects to his list, then, when a project is selected, he 
should have access to all the relevan documents in that project, again 
allowing him to add/remove documents from the project here, and in the 
last step, when a document is selected, allows hime to add/remove/edit 
chapters to the document.

My first attempt at using sessions with this failed miserably ( keeping 
in mind my approach of adding SID at end of urls). I have a "back" link 
on all the pages that takes the user to the previous  step(s) and thus 
on the last page ( the chpaters edit/remove/add page), there is a link 
to go back one level, two and three levels. Yet, using these causes 
unexpected results.
I think the problem comes in with overriding the value of the session 
For instance, on the first page you have a login form, on the action 
page I session_register("username","password"), and that works fine even 
when using the back buttons as the values are never changed. But, on the 
2nd page I have the drop down select containing all the project names ( 
gets built with a while that reads all the project names from the 
project_table) and send over the project_id.
On that actio page, I session_register("project_id"); and it also works 
fine for all pages "down stream", however, when I come back to that page 
to select a new project, it keeps the old variable...
At first I did nothing special in the sence of assigning a value to the 
session variables, as I let the register_globals=on do it's trick, but 
later I explicitly said
$project_id = $HTTP_POST_VARS["project_id"];

But that also did not overwrite the value of the session var. In the end 
I was forced to again add all my variables to the end of the url, 
keeping the session solely for the username and password.

I don't know if you would like  me to post my code (  it is quite a bit 
already ) but I would really appreciate it if someone could look at it, 
and then point out where I'm missing the picture, as then I would have 
two pictures that I can compare and see where my reasoning failed.

Thanks for your time.

Rasmus Lerdorf wrote:

>What issues?  Just ask.
>On Mon, 29 Jul 2002, Petre wrote:
>>What are good books/websites about sessions.
>>I'm looking for more advanced stuff, I have the Luke Welling/Laura
>>Tompson book, and have read the manual, but I still have issues that are
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to