replace session management routines with memcached

This commit is contained in:
Jeremy Newman
2008-02-08 13:15:54 -06:00
parent 86ced92c4c
commit 7666f6d0da
7 changed files with 115 additions and 162 deletions

View File

@@ -252,22 +252,13 @@ function pHttpDate($sDate) {
*/
function addmsg($shText, $color = "black")
{
if($color)
$shText = "<font color='$color'> $shText </font>\n";
$sQuery = "INSERT INTO sessionMessages VALUES (null, ?, '?', '?')";
if (!query_parameters($sQuery, "NOW()", session_id(), $shText))
{
echo "An error has occurred in addmsg()";
echo $shText;
}
$GLOBALS['session']->addmsg($shText, $color);
}
function purgeSessionMessages()
{
$sQuery = "truncate sessionMessages";
query_parameters($sQuery);
$GLOBALS['session']->purgemsg();
}
@@ -276,19 +267,17 @@ function purgeSessionMessages()
*/
function dumpmsgbuffer()
{
$hResult = query_parameters("SELECT * FROM sessionMessages WHERE sessionId = '?'", session_id());
if(!$hResult)
return;
$GLOBALS['session']->dumpmsgbuffer();
while($oRow = query_fetch_object($hResult))
echo html_frame_start("","300","",5);
foreach ($GLOBALS['session']->msg as $msg)
{
echo html_frame_start("","300","",5);
echo "<div align=center> $oRow->message </div>";
echo html_frame_end("&nbsp;");
echo "<br>\n";
if ($msg['color'] == "red")
$msg['color'] = "{$msg['color']};text-decoration:blink";
echo "<div align=\"center\" style=\"font-color:{$msg['color']};\"> {$msg['msg']} </div>";
}
query_parameters("DELETE FROM sessionMessages WHERE sessionId = '?'", session_id());
echo html_frame_end("&nbsp;");
echo "<br>\n";
}
/**