Protecting Controllers and Views

I wrote code in my form.php to protect my post.php from being accessed by non - authenticated users. Instead, the code I implemented redirects the user to my Blog and kills the program trying to access my post.php