function mtrc_bool_store($what, $where, $type = NULL, $params) { $result = false; switch ($type) { case 'cookie': $result = setcookie($where, $what, $expire); break; case 'session': $_SESSION[$where] = $what; if ($_SESSION[$where] == $what) { $result = true; } else { $result = false; } break; case 'dbm': // don't know what to do with these yet... if (!($dbm = dbmopen($this->defaultDBMname, "c"))) { $result = false; } $result = dbminsert($dbm, $where, $what); return true; break; case 'global': $GLOBALS[$where] = $what; if ($GLOBALS[$where] == $what) { return true; } else { return false; } break; case 'mysql': /* * INSERT INTO table_name (column1, column2, column3,...) * VALUES (value1, value2, value3,...) * * $where needs to be 'table_name (column1, column2, column3,...)' * $what needs to be 'value1, value2, value3,...'... * */ // make sql $sql = 'INSERT INTO ' . $where . 'VALUES (' . $what . ')'; // execute it.. $res = mysql_query($sql, GetMyConnection(isset($params['dbacct']) ? NULL : $params['dbacct'])); break; default: if ($this->cookiesOK && !headers_sent) { $reult = setcookie($where, $what); } else { $_SESSION[$where] = $what; //$reult = 'default to _SESSION[ ' . $where . ' ].'; $result = true; } } return $result; }
function IncreaseHitCount($dbi, $pagename) { if (dbmexists($dbi['hitcount'], $pagename)) { // increase the hit count // echo "$pagename there, incrementing...<br>\n"; $count = dbmfetch($dbi['hitcount'], $pagename); $count++; dbmreplace($dbi['hitcount'], $pagename, $count); } else { // add it, set the hit count to one $count = 1; dbminsert($dbi['hitcount'], $pagename, $count); } }
function dba_insert($key, $string, $handle) { return dbminsert($handle, $key, $string); }
function store($what, $where, $type = NULL) { $result = false; switch ($type) { case 'cookie': $result = setcookie($where, $what); break; case 'session': if (isset($_SESSION[$where])) { $result = 'overwrite'; } else { $result = true; } $_SESSION[$where] = $what; break; case 'dbm': // don't know what to do with these yet... if (!($dbm = dbmopen($this->defaultDBMname, "c"))) { $result = false; } $result = dbminsert($dbm, $where, $what); break; case 'global': $GLOBALS[$where] = $what; if ($GLOBALS[$where] == $what) { return true; } else { return false; } break; default: if ($this->cookiesOK && !headers_sent) { $reult = setcookie($where, $what); } else { $_SESSION[$where] = $what; $reult = 'default to _SESSION[ ' . $where . ' ].'; } } return $reult; }
function IncreaseHitCount($dbi, $pagename) { return; return; // kluge: we ignore the $dbi for hit counting global $WikiDB; $hcdb = OpenDataBase($WikiDB['hitcount']); if (dbmexists($hcdb['active'], $pagename)) { // increase the hit count $count = dbmfetch($hcdb['active'], $pagename); $count++; dbmreplace($hcdb['active'], $pagename, $count); } else { // add it, set the hit count to one $count = 1; dbminsert($hcdb['active'], $pagename, $count); } CloseDataBase($hcdb); }