Skip to content

Commit

Permalink
* refs #1113
Browse files Browse the repository at this point in the history
 * 세션초기값을 굉장히 빨리 제거되도록 설정
  • Loading branch information
coolengineer committed Oct 2, 2008
1 parent 51c02df commit 25df02f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@ function getAnonymousSession() {
return false;
}

function newAnonymousSession() {
global $database, $service;
$meet_again_baby = 3600;
if( isset($service['timeout']) ) {
$meet_again_baby = $service['timeout'];
}

//If you are not a robot, subsequent UPDATE query will override to proper timestamp.
$meet_again_baby -= 60;

for ($i = 0; $i < 100; $i++) {
if (($id = getAnonymousSession()) !== false)
return $id;
$id = dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF));
$result = sessionQuery('count',"INSERT INTO {$database['prefix']}Sessions (id, address, created, updated) VALUES('$id', '{$_SERVER['REMOTE_ADDR']}', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() - $meet_again_baby)");
if ($result > 0)
return $id;
}
return false;
}

function newAnonymousSession() {
global $database;
for ($i = 0; $i < 100; $i++) {
Expand Down

0 comments on commit 25df02f

Please sign in to comment.