Details - Web 2.0 & AJAX :: passing cookie/session values in an ajax site

This thread was displayed: 875 times


Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.

For more information about the affected products visit: www.interaktonline.com/Support/

View Threaded Show descending
Neo314
09-10-2006 09:37:34 GMT +2

I am trying to increment the state of one panel through 4 states changing every time the main content panel is changed. I am attempting to do this by triggering a reload of the default state of this panel for every state of the main content window.

I tried:

session_start();
if ($_SESSION['valuePanel'] == '') {
  $_SESSION['valuePanel'] = 0;
} else {
  $_SESSION['valuePanel']++;
}
if ($_SESSION['valuePanel'] >= 4) { $_SESSION['valuePanel'] = 0; }
$valuePanel=$_SESSION['valuePanel'];

with and without session_start(). I placed this code in the body and then tried it in the header of the panel state.

I also tried to use cookies with:

// IF NO COOKIE IS SET, SET COOKIE
if (!isset($_COOKIE['valuePanel'])) {
  if (setcookie('valuePanel',1,time()+7200)) {
    // IF COOKIE CAN BE SET
    $valuePanel = 0;
  } else {
    // IF COOKIE CAN'T BE SET
    $valuePanel = rand(0,3);
  }
} else {
// ELSE A COOKIE ALREADY HAS BEEN SET, INCREMENT IT.
  $valuePanel = $_COOKIE['valuePanel'];
  if ($_COOKIE['valuePanel'] >= 3) {
    setcookie('valuePanel',0,time()+7200);
  } else {
    setcookie('valuePanel',$_COOKIE['valuePanel']++,time()+7200);
  }
}

in the header of the panel state. Am I doing something wrong? I have used session variables in other pages without a problem. Do I need to use another method with AJAX?

Thanx

Steven

Back | Reply | Quote | Top
Neo314
09-11-2006 21:57:44 GMT +2

I did get session variables to work by using an included file that contained the function rather than having the code in the panel page.

Reply | Quote | Top
Catalin ANASTASOAIE[InterAKT]Adobe Systems Romania staff
09-14-2006 14:24:03 GMT +2

Hello,

Do you need anymore help with this issue?

Best Regards,
Catalin Anastasoaie

Reply | Quote | Top
Neo314
09-14-2006 19:56:11 GMT +2

I would like to know if there is a known reason why the session variable works in the include file but not in the panel file itself, and if there is a way to set/change a cookie value when a panel changes.

My immediate problem is solved.

Thanx,
Steven

Reply | Quote | Top
Home > Support > Forums > Web 2.0 & AJAX > Details - Web 2.0 & AJAX
Adobe acquired InterAKT
InterAKT has been acquired by Adobe.
Learn more
 
© Adobe Systems Romania. All rights reserved.