Hi,
Thanks for the class.
How can I protect a page/more pages against everyone except one registered user?
PHP related forum, discuss snippets, classes and tutorials
Hi,
Thanks for the class.
How can I protect a page/more pages against everyone except one registered user?
Hi,
just using PHP?
if (isset($_SESSION['user']) && $_SESSION['user'] == 'theuser') {
echo 'you\'re the power user';
}
but maybe it's better to protect those page using .htaccess?
Thanks for the fast answer.
I will try the php version. I don't know mutch about .htaccess.
Or is the .htaccess solution also simple?
Quote from: Kenvs
"Thanks for the fast answer.
I will try the php version. I don't know mutch about .htaccess.
Or is the .htaccess solution also simple?"
.htaccess is easy, check your hosting panel for "Directory protection"
if (isset($_SESSION['user']) && $_SESSION['user'] == 'theuser') {
echo 'you\'re the power user';
}
In your example I must now who is the user? Right? $_SESSION['user'] == 'theuser'
But when I use your login/login_local form, it can be everyone (who is registered).
How can I, after logging in, protect a page/more pages against everyone except one (the unknow person that just had logging in) registered user?
Maybe, it must be something like used when the user go from the login_local page to the update_user_profile. The update_user_profile page is also a page just for one user, I think.
You wanted to protect a page for all except one user, you didn't know which one?
if you don't know this single one, it could be everyone...
maybe I don't understand what you're trying?
The problem is that I can't specify (I don't know the name) the user that just had logging in.
$_SESSION['user'] == 'theuser'
Sorry, it's not easy for my, writing in english. (I'm dutch speaking)
but how do you identify this single user? last registration? last login?
What information you like to use?
First, the users must registrated. (that's work)
After that, the users must log in. (that's work too)
After that, the users have access to there peronal pages. (I dont know how?)
Every user has his personal pages.
check the example for the edit profile feature
You must log in to post.