本文整理汇总了PHP中ADODB_Session_Key函数的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_Session_Key函数的具体用法?PHP ADODB_Session_Key怎么用?PHP ADODB_Session_Key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADODB_Session_Key函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adodb_sess_write
function adodb_sess_write($key, $val)
{
$Crypt = new MD5Crypt();
global $ADODB_SESS_INSERT, $ADODB_SESS_CONN, $ADODB_SESS_LIFE, $ADODB_SESSION_TBL, $ADODB_SESSION_EXPIRE_NOTIFY;
$expiry = time() + $ADODB_SESS_LIFE;
// encrypt session data..
$val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());
$arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
$var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
global ${$var};
$arr['expireref'] = ${$var};
}
$rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL, $arr, 'sesskey', $autoQuote = true);
if (!$rs) {
ADOConnection::outp('
-- Session Replace: ' . $ADODB_SESS_CONN->ErrorMsg() . '</p>', false);
} else {
// bug in access driver (could be odbc?) means that info is not commited
// properly unless select statement executed in Win2000
if ($ADODB_SESS_CONN->databaseType == 'access') {
$rs = $ADODB_SESS_CONN->Execute("select sesskey from {$ADODB_SESSION_TBL} WHERE sesskey='{$key}'");
}
}
return isset($rs);
}
示例2: adodb_sess_write
function adodb_sess_write($key, $val)
{
$Crypt = new MD5Crypt();
global $ADODB_SESS_INSERT, $ADODB_SESS_CONN, $ADODB_SESS_LIFE, $ADODB_SESSION_TBL;
$expiry = time() + $ADODB_SESS_LIFE;
// encrypt session data..
$val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());
$qry = "UPDATE {$ADODB_SESSION_TBL} SET expiry={$expiry},data='{$val}' WHERE sesskey='{$key}'";
$rs = $ADODB_SESS_CONN->Execute($qry);
if ($rs) {
$rs->Close();
} else {
print '<p>Session Update: ' . $ADODB_SESS_CONN->ErrorMsg() . '</p>';
}
if ($ADODB_SESS_INSERT || $rs === false) {
$qry = "INSERT INTO {$ADODB_SESSION_TBL}(sesskey,expiry,data) VALUES ('{$key}',{$expiry},'{$val}')";
$rs = $ADODB_SESS_CONN->Execute($qry);
if ($rs) {
$rs->Close();
} else {
print '<p>Session Insert: ' . $ADODB_SESS_CONN->ErrorMsg() . '</p>';
}
}
// bug in access driver (could be odbc?) means that info is not commited
// properly unless select statement executed in Win2000
if ($ADODB_SESS_CONN->databaseType == 'access') {
$rs = $ADODB_SESS_CONN->Execute("select sesskey from {$ADODB_SESSION_TBL} WHERE sesskey='{$key}'");
}
return isset($rs);
}