private function toXmlValue($a_key, $a_value) { switch (gettype($a_value)) { default: return makePair($a_key, $a_value); case 'string': if (preg_match("/\\n\\r\\t/i", $a_value)) { return $this->makePair($a_key, '<![CDATA[' . $a_value . ']]>'); } return $this->makePair($a_key, addcslashes($a_value, "\n\r\t\"")); case 'array': $o = null; foreach ($a_value as $k => $v) { $o .= $this->toXmlValue($k, $v); } return $this->makePair($a_key, $o); case 'object': $o = null; foreach (get_object_vars($a_value) as $k => $v) { $o .= $this->toXmlValue($k, $v); } return $this->makePair($a_key, $o); } return null; }
function openPair() { global $okMsg; $make = makePair(); if ($make == $okMsg) { $_SESSION['authpair'] = microtime(); // the value has no particular meaning, yet return true; } else { return false; } }
} else { session_write_close(); $oldSID = session_id($oldSID); session_start(); return false; } } if ($_POST[$commandKey] == $cmdJump) { if (validateJumpToken($_POST['token'])) { } header("Location: " . "{$jumpProto}://{$jumpHost}{$jumpPage}"); } else { if ($_POST[$commandKey] == $cmdToken) { echo generateToken(); } else { if ($_POST[$commandKey] == $cmdOpen) { $msg = validateChallange($_POST['response'], $_POST['key']); if ($msg == $okMsg) { makePair(); } echo $msg; } else { if ($_GET[$commandKey] == $cmdClose) { breakPair(); echo $okMsg; } else { echo generateChallange(); } } } }