Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
1fc40c3e
Commit
1fc40c3e
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Don't update the session unless it changes
And deadband session token updates to 1 per 30 seconds
parent
ea7b8b5e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/class.ostsession.php
+5
-0
5 additions, 0 deletions
include/class.ostsession.php
include/class.usersession.php
+17
-2
17 additions, 2 deletions
include/class.usersession.php
scp/ajax.php
+1
-0
1 addition, 0 deletions
scp/ajax.php
scp/autocron.php
+1
-0
1 addition, 0 deletions
scp/autocron.php
with
24 additions
and
2 deletions
include/class.ostsession.php
+
5
−
0
View file @
1fc40c3e
...
...
@@ -18,6 +18,7 @@ class osTicketSession {
var
$ttl
=
SESSION_TTL
;
var
$data
=
''
;
var
$data_hash
=
''
;
var
$id
=
''
;
function
osTicketSession
(
$ttl
=
0
){
...
...
@@ -87,12 +88,16 @@ class osTicketSession {
list
(
$this
->
data
)
=
db_fetch_row
(
$res
);
$this
->
id
=
$id
;
}
$this
->
data_hash
=
md5
(
$this
->
data
);
return
$this
->
data
;
}
function
write
(
$id
,
$data
){
global
$thisstaff
;
if
(
md5
(
$data
)
==
$this
->
data_hash
)
return
;
$ttl
=
(
$this
&&
get_class
(
$this
)
==
'osTicketSession'
)
?
$this
->
getTTL
()
:
SESSION_TTL
;
...
...
This diff is collapsed.
Click to expand it.
include/class.usersession.php
+
17
−
2
View file @
1fc40c3e
...
...
@@ -66,6 +66,14 @@ class UserSession {
return
(
$token
);
}
function
getLastUpdate
(
$htoken
)
{
if
(
!
$htoken
)
return
0
;
@
list
(
$hash
,
$expire
,
$ip
)
=
explode
(
":"
,
$htoken
);
return
$expire
;
}
function
isvalidSession
(
$htoken
,
$maxidletime
=
0
,
$checkip
=
false
){
global
$cfg
;
...
...
@@ -122,7 +130,10 @@ class ClientSession extends Client {
}
function
refreshSession
(){
global
$_SESSION
;
$time
=
$this
->
session
->
getLastUpdate
(
$_SESSION
[
'_client'
][
'token'
]);
// Deadband session token updates to once / 30-seconds
if
(
time
()
-
$time
<
30
)
return
;
$_SESSION
[
'_client'
][
'token'
]
=
$this
->
getSessionToken
();
//TODO: separate expire time from hash??
}
...
...
@@ -160,7 +171,11 @@ class StaffSession extends Staff {
}
function
refreshSession
(){
global
$_SESSION
;
$time
=
$this
->
session
->
getLastUpdate
(
$_SESSION
[
'_staff'
][
'token'
]);
// Deadband session token updates to once / 30-seconds
if
(
time
()
-
$time
<
30
)
return
;
$_SESSION
[
'_staff'
][
'token'
]
=
$this
->
getSessionToken
();
}
...
...
This diff is collapsed.
Click to expand it.
scp/ajax.php
+
1
−
0
View file @
1fc40c3e
...
...
@@ -21,6 +21,7 @@ function staffLoginPage($msg='Unauthorized') {
exit
;
}
define
(
'AJAX_REQUEST'
,
1
);
require
(
'staff.inc.php'
);
//Clean house...don't let the world see your crap.
...
...
This diff is collapsed.
Click to expand it.
scp/autocron.php
+
1
−
0
View file @
1fc40c3e
...
...
@@ -14,6 +14,7 @@
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
define
(
'AJAX_REQUEST'
,
1
);
require
(
'staff.inc.php'
);
ignore_user_abort
(
1
);
//Leave me a lone bro!
@
set_time_limit
(
0
);
//useless when safe_mode is on
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment