Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mkdesign82's avatar

Protect php webforms from accessing without login

Hi guys

I have 20 forms (20 PHP file) made with pure PHP, there is no architecture used for building this 20 forms. some of this forms are using for the front of the website and some other are used for the back, dashboard panel. now I want to protect my dashboard panel. which only those users which are login should access it and block access for the rest of users which are not login.

the hierarchy of the application is as below

-- the front index.php invitaion.php language.php lession.php login.php register.php mainHeader.php payments.php pricing.php pricingPanel.php

-- the back panelDashboard.php panelAdmin.php panelCountries.php panelHeader.php panelFooter.php panelLanguage.php panelConsultancy.php panelKeyFacts.php panelExport.php PanelWorldViews.php

the above files as you can see they exist in the root directory. now I want to know how to create a middleware that coasts me fewer changes. or anything that solves my problem.

thanks for any help. if you guys need more info please inform me.

0 likes
5 replies
Snapey's avatar

start out with a blank laravel project. Add authentication to it, learn how MVC and routing works.

Then move your forms into the framework

mkdesign82's avatar

this coasts a lot of time, we are not in the faze of converting the project. I just wanna simpler solution thanks.

topvillas's avatar

Create a login form. Put the authenticated user in the session. Check for the user before you show your forms.

Snapey's avatar

you could look on sitepoint.com and see if they still have any articles from 2009

1 like
dan3460's avatar

@Snapey is right. It will not take a long time to get a basic Laravel application with authentication up and running. Using what is given when you set up a new application, modify the navigation file to access the forms. I'm sure it will take you less that a day to do it.

Please or to participate in this conversation.