get_node_with_code($code); if($file_id==NULL) { http_response_code(409); exit(0); } $premissions=$database->get_premissions($file_id,$user->user_id); if($premissions["can_view"]==true) { $node=$database->get_node($file_id); if($node->is_directory) { /*spooky stuff here*/ http_response_code(409); exit(1); }else { header("Content-type: $node->type"); readfile("$storage_root/$node->code"); } } }else { http_response_code(409); exit(0); } ?>