Reputation: 143
I have around 14 script files for an admin page. Written in PHP.
Those files I actually call up when using the web browser are the following ones:
admin_flag.php - To the see "flagged" "threads".
admin_login.php - The login page for the admin.
admin_page.php - The admin page.
admin_modify.php - The page where "editing" to the "threads" can be taken. By the admin.
I would prefer if only "these" pages have the following included in the top of the files:
"session_start()"
"if statement" where it checks if a successful login is given
Also, I would want that the other 10 script files can not be called up through the URL, by for example guessing the names.
How to set up such config file, where to start with this?
I would appreciate the suggestions a lot.
Upvotes: 1
Views: 63
Reputation: 1641
Create a seperate file for your session_start
+ if logged
snippet.
Import your new snippets file to your 4 main files via require_once
.
Use .htacces to block access to the desired files.
Upvotes: 4