Mr Hyde
Mr Hyde

Reputation: 3413

PHP snippet Code Security

I am writing this in PHP

$edit_window = $database_info->timestamp + 86400;
$current_timestamp = time ();

if ($current_timestamp > $edit_window){
        $database_info->editable = TRUE;
     } 
else {
        $database_info->editable = FALSE;
     }

then

if ($database_info->editable){
//do some major stuff
}

Somehow this code is worrying me. Is it open to vulnerablities? Is there a better approach?

Upvotes: 1

Views: 74

Answers (1)

Peter C
Peter C

Reputation: 6307

It doesn't look vulnerable. Are you storing any user-provided data in the database (or inserting it into HTML) or relying on cookies or headers that could be spoofed?

Upvotes: 1

Related Questions