[phplib] session problems From: Faine, Mark (Mark.Faine <email protected>)
Date: 04/18/01

I have a php script which is like a modified shopping cart.

It starts with a search that calls a perl script ( I know, but it's the
only way I can include certain proprietary functionality I need). This
returns a results set of documents that can be either downloaded or
requested
depending on permissions.

If you click to request a document a php script request.php is called it
 is sort of like a cart script, and uses phplib sessions and db_oci8. The
strange problem I am having is this:

 If it is the first time you have reqeusted this script since last
opening your browser, you will get a 404, if you hit back/forward or
refresh the
script works fine as if nothing ever happened. You will not get this error
again as long as you do not close and reopen your browser.

 Any ideas?

Here is the script

"request.php" 62 lines, 1585 characters
<?
include ("layout.php");

page_open(array("sess" => "Repository_Session"));

  if (!isset($s)) { $s=0; };
  $sess->register("s");

site_header("Request a Document - Document Cart");

echo '<P align=left><font face="Arial, Helvetica, sans-serif" size="2"
color="#000066">Below
  is your <b><i><font color="#FF0000">Document Cart</font></i></b>.<br>
  <br>
  </font><font face="Arial, Helvetica, sans-serif" size="2"
color="#000066">Any
  time you request a document we will store it here. You may <a
href="http://starbase.msfc.nasa.gov/rs-bin/show_files.pl?search='.$s
earch.'">
 return to your search
  results</a> at any time and choose another document<br>
  or you may perform a <a href="search.php">New Search</a>.<br>
  <br>
  </font><font face="Arial, Helvetica, sans-serif" size="2">You may also
Increase
  or Decrease the Number of copies you wish to request by using the <font
color="#FF0000">Add/Remove
  </font>links, or completly empty the cart with the <font
color="#FF0000">Clear
  cart</font> link.<br>
  <br>
  </font><font face="Arial, Helvetica, sans-serif" size="2"
color="#000066">Whenever
  you are done selecting documents click the <i><font
color="#FF0000">Checkout</font></i><font color="#FF0000">
  </font>link to process your request.</font></P>
<BR>';
global $scart;
global $obj_id;
$scart->start();

switch($action)
{
        case add:
        $scart->add_item($obj_id,1);
        break;
        case remove:
        $scart->remove_item($obj_id,1);
        break;
        case clearcart:
        $scart->reset();
        break;
}
$scart->show_all();
page_close();

site_footer();

?>

 
I also have a question as to where to put the page
page_open(array("sess" => "Repository_Session"));
 
On every page, or only some, even files that are only included or all?
 
-Mark

_____________________________________

Mark Faine
Computer Programmer III/MTRS Administration
Lesco/MSFC
256-961-1295