// $expire = the time in seconds until a session have to expire
function start_session($expire = 0) {
if ($expire == 0) {
$expire = ini_get("session.gc_maxlifetime");
} else {
ini_set("session.gc_maxlifetime", $expire);
}
if (empty($_COOKIE['PHPSESSID'])) {
session_set_cookie_params($expire);
session_start();
} else {
session_start();
setcookie("PHPSESSID", session_id(), time() + $expire);
}
}
// this example will start a session with an expire time given by the php configuration
start_session();
// start_session(600) will start a session which will expire after 10 minutes (60*10 seconds)
?>
[/php]
[pascal]
function EnCode(ACode: string): string;
var
I: Integer;
Hex: string;
Code: AnsiString;
begin
Code := AnsiString(ACode);
for I := 1 to Length(Code) do
case Code[i] of
‘ ‘: Result := Result + ‘+’;
‘A’..’Z’, ‘a’..’z’, ‘*’, ‘@’, ‘.’, ‘_’, ‘-‘,
‘0’..’9′, ‘$’, ‘!’, ””, ‘(‘, ‘)’:
Result := Result + Code[i];
else
begin
Hex := IntToHex(ord(Code[i]), 2);
if Length(Hex) = 2 then
Result := Result + ‘%’ + Hex
else
Result := Result + ‘%0’ + hex;
end;
end;
end;
[/pascal]