Jump to content

[SOLVED] session question?!


jakebur01

Recommended Posts

I have been looking for something that will allow me to use a session only for part of a couple of pages.

 

Example: I use session_start() at the top of all my pages, but on the categories page and home page I only want the session_start() to apply to the cart quanity and amount and not apply to all the rest of the links on the homepage.

 

In other words, is their any way to turn off 'so to speak' the session after do_html_header() ? I don't want to destroy the session, I just want the session_start() to apply to only part of the page.

session_start();

  $catid = $_GET['catid'];
  $name = get_category_name($catid);

  do_html_header($name);

  $book_array = get_books($catid);

  display_books($book_array);

Link to comment
Share on other sites

I tried session_write_close() and it didn't work, I still had session id's in all my links below session_write_close() . I also tried session_destroy() and all it did was wipe out everything that I had in my cart.

 

There has to be a function out there that will turn the session off for part of a page without destroying the session or loosing anything.

Link to comment
Share on other sites

So I won't have session id's attached to all my category and product links. I can solve this by just not doing session_start() on the homepage , but then my cart quanity and cart amount at the top of the page will all equal zero. So thats why I am wanting to keep the session for the top half and not have the session for the bottom half.

Link to comment
Share on other sites

So I won't have session id's attached to all my category and product links.

 

Don't put session_start() in the files these links point to then. There is no function that does what you wish. Sessions simply do not work as you may think. Sessions apply to each request, not parts of scripts.

Link to comment
Share on other sites

i read somewhere that you can remove PHPSESSID from your urls by using .htaccess

 

copy this into your .htaccess file, not sure if it will work though. you maybe able to edit your php.ini file...

 

htaccess:

php_flag session.use_trans_sid off

 

give it a go, otherwise, i dunno. perhaps someone else can elaborate a bit further on this.

Link to comment
Share on other sites

i read somewhere that you can remove PHPSESSID from your urls by using .htaccess

 

copy this into your .htaccess file, not sure if it will work though. you maybe able to edit your php.ini file...

 

htaccess:

php_flag session.use_trans_sid off

 

give it a go, otherwise, i dunno. perhaps someone else can elaborate a bit further on this.

 

That is the best way to use sessions, it removes those annoying ids from the links and put the sessionid into a cookie. This will solve your problem of wanting to not use "session_start" as it would not append the session id to the urls.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.