session handler error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am learning some more advanced php techniques and have been working
on a script setting session functions to store session data on a
database.  I will include the script, but when I run it, I don't get
an error from the browser it just doesn't load, and I get a message
from windows that there was an error and it is stopping the apache
server.  I am testing this on a local host.  If anyone can help me
with this I would appreciate it.  Here is the script:

<?php

/* this page does some silly things with sessions
 * It includes the db_sessions.inc.php script
 * so that the session data will be stored in a database
 */
 
 // Include the sessions file:
 // The file already starts the session
 require_once ('db_sessions.inc.php');
 ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>DB sessions test</title>
</head>

<body>
<?php

// Store some dummy dat in the session,
// if no data is present
 if(empty($_SESSION)) {
 
   $_SESSION['blah'] = 'umlaout';
   $_SESSION['this'] = 3615684.45;
   $_SESSION['that'] = 'blue';
   
   // Print a message indicating whats going on:
   echo '<p>Session data stored</p>';
   
   } else {
   
    echo '<p>Session Data Exists:<pre>' . print_r($_SESSION, 1) .
'</pre>';
   }
   
   // Log the user out, if applicable
   if(isset($_GET['logout'])) {
    
	  session_destroy();
	  echo'<p>Sesion destroyed.</p>';
	  
	} else { //print the "Lout Out" link:
	  echo '<a href="sessions.php?logout=true">Log Out</a>';
	 }
	 
	 // Print out the session data:
	 echo '<p>Session Data:<pre>' . print_r($_SESSION, 1). '</pre></p>';
?>
</body>
</html>
<?php session_write_close(); ?>

and gets called by this script:

<?php

/* this page does some silly things with sessions
 * It includes the db_sessions.inc.php script
 * so that the session data will be stored in a database
 */
 
 // Include the sessions file:
 // The file already starts the session
 require_once ('db_sessions.inc.php');
 ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>DB sessions test</title>
</head>

<body>
<?php

// Store some dummy dat in the session,
// if no data is present
 if(empty($_SESSION)) {
 
   $_SESSION['blah'] = 'umlaout';
   $_SESSION['this'] = 3615684.45;
   $_SESSION['that'] = 'blue';
   
   // Print a message indicating whats going on:
   echo '<p>Session data stored</p>';
   
   } else {
   
    echo '<p>Session Data Exists:<pre>' . print_r($_SESSION, 1) .
'</pre>';
   }
   
   // Log the user out, if applicable
   if(isset($_GET['logout'])) {
    
	  session_destroy();
	  echo'<p>Sesion destroyed.</p>';
	  
	} else { //print the "Lout Out" link:
	  echo '<a href="sessions.php?logout=true">Log Out</a>';
	 }
	 
	 // Print out the session data:
	 echo '<p>Session Data:<pre>' . print_r($_SESSION, 1). '</pre></p>';
?>
</body>
</html>
<?php session_write_close(); ?>


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux