Do you really need to keep changing the value of the session variables? couldn't you just set them once and be done with it? I dont really understand why you have code to reset them on every page. It seams to me that you could use the following code on each page:
<?php
if (!session_id()) session_start();
if(!isset($_SESSION["CartAccessCode1"])) {
$_SESSION["CartAccessCode1"] = WA_RandomPassword(10, true, true, true, "");
}
if(!isset($_SESSION["CartAccessCode2"])) {
$_SESSION["CartAccessCode2"] = WA_RandomPassword(10, true, true, true, "");
}
?>
This would ensure that where set once. it doesn't seam to me like they need to be reset every time the add to cart button is pressed.