Reputation: 111
I'm writing a data entry form for my professor to enter Herbarium data into a MySQL database. I've written up a web form in PHP to enter in the data, and hosted it on a server.
However, I don't want just anyone to be able to enter in data. I'd like to set a simple username/password prompt, and give the credentials to the current data entry typist.
Is there any way of doing it simply like this a linksys router prompt? I need to get this site functional as soon as possible, and will develop something more secure later.
Upvotes: 1
Views: 181
Reputation: 13966
Use the session and make another form that accepts username and password. Validate the username and password to your database.
You can make secure passwords by hashing or salting it (you can google how to do that).
If the username and password don't match make them go to the login page again, and if they do match redirect to the main form that you made. On the page with the form make sure you start it with:
session_start();
if ( !$_SESSION['loggedin'] ) {
header ( "Location: login.php" ); // this will re-direct them if they aren't logged in
}
Upvotes: 0
Reputation: 49673
Use an .htaccess file (combined with a .htpasswd file).
This is very easy to set up, and a good protection (standard Apache functionnality) as long as you have a limited number of logins/passwords.
Upvotes: 6