File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -18,15 +18,22 @@ public static function get_token() {
1818
1919 // Used to check a submitted token with a token stored in the session
2020 public static function check_token ($ submitted_token ) {
21- // Bring in the session variable
22- global $ session ;
23-
24- // Check if the submitted token matches the one in the database
25- if ($ submitted_token == $ session ->get ('csrf_token ' )) {
26- // Token is the same
27- return true ;
21+ // Check if a token was submitted
22+ if ($ submitted_token ) {
23+ // Token was submitted
24+ // Bring in the session variable
25+ global $ session ;
26+
27+ // Check if the submitted token matches the one in the database
28+ if ($ submitted_token == $ session ->get ('csrf_token ' )) {
29+ // Token is the same
30+ return true ;
31+ } else {
32+ // Token is not the same
33+ return false ;
34+ }
2835 } else {
29- // Token is not the same
36+ // Token wasn't submitted
3037 return false ;
3138 }
3239 }
You can’t perform that action at this time.
0 commit comments