John Carney
asked on
Creating a php session script with password required
I have a site on which I want to limit access to the three of the pages to users who have the correct username and password. I would like a php script so that as soon as the user clicks on the navbar button for any one of those pages, he gets a prompt that requires username and password. (In this case they will be the same for all authorized users, no database interaction required).
I would also like the php script to create a session so that the user will not have to re-enter the login when he goes to one of the other protected pages or returns to them.
Let's say that the 3 protected pages are: page2.html, page3.html, and page4.html.
I'll continue researching this online, but please give me as much as you can, up to and including the whole script. I'm really not one of those people looking for you to do my coding. I always learn best when I have a working example in front of me to start with.
Thanks!
John
I would also like the php script to create a session so that the user will not have to re-enter the login when he goes to one of the other protected pages or returns to them.
Let's say that the 3 protected pages are: page2.html, page3.html, and page4.html.
I'll continue researching this online, but please give me as much as you can, up to and including the whole script. I'm really not one of those people looking for you to do my coding. I always learn best when I have a working example in front of me to start with.
Thanks!
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
gabrielPennyback,
Did the information I provide help you find a solution?
ou_dober
Did the information I provide help you find a solution?
ou_dober
ASKER
The only thing I need to know is where I set the username and password. Right now all I need is one username and password for everyone using the site.
John
John
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That clears it up and now I can see the logic of it. Thanks!
ASKER
Thanks again.
- John
- John
ASKER
My best guess is that I set them here, and that the username is 'root' and the password is "adminpass'
'zubrag' => 'root',
'admin' => 'adminpass'
But if that's correct why doesn't say this:
'username' => 'root',
'password' => 'adminpass'
???
Thanks, John
Open in new window