02-13-2018, 01:22 PM
Hi! I have a question regarding this topic.
I built an index.php with an if/else statement. If the user is not logged in it will display the title and a link to the users/login.php. Else the logged in user will see the content on the index.php.
I want the users to be redirected to the index.php after the login. Therefore I changed the users/index.php to
<pre></pre>
Unfortunately users with access to the users/account.php (I did some translation to german, removed the gravatar but changed nothing else) don't get redirected to the index.php after logging in. The standard user has access to a different account_s.php. I copied the code from the account.php, hid the email inputs and set the fname/lname input to readonly (the useraccounts for the standard users are created manually without any email and should only be able to change the password). These users get redirected correctly to the root index.php. But I think what happens is that the standard users is also redirected to the account.php. Since he doesn't have access to it but is logged in, he gets redirected to the root index.php.
The users/index.php has public access. If I'm logged and type in the "localhost/.../users/index.php" I get redirected correctly to the root index.php.
Do I have to change any code in the login.php? I'm constantly learning but I'm not good enough to understand every process/line in the login.php
Edit: I activated the web-development tools of my Firefox and saw that my guess was correct (the standard user is redirected to the account.php and then to the index.php (because he doesn't have access to it)). The users/index.php isn't called while login in at all.
I built an index.php with an if/else statement. If the user is not logged in it will display the title and a link to the users/login.php. Else the logged in user will see the content on the index.php.
I want the users to be redirected to the index.php after the login. Therefore I changed the users/index.php to
<pre>
Code:
<?php
require_once 'init.php';
if(isset($user) && $user->isLoggedIn()){
Redirect::to($us_url_root.'index.php');
}else{
Redirect::to($us_url_root.'users/login.php');
}
die();
?>
Unfortunately users with access to the users/account.php (I did some translation to german, removed the gravatar but changed nothing else) don't get redirected to the index.php after logging in. The standard user has access to a different account_s.php. I copied the code from the account.php, hid the email inputs and set the fname/lname input to readonly (the useraccounts for the standard users are created manually without any email and should only be able to change the password). These users get redirected correctly to the root index.php. But I think what happens is that the standard users is also redirected to the account.php. Since he doesn't have access to it but is logged in, he gets redirected to the root index.php.
The users/index.php has public access. If I'm logged and type in the "localhost/.../users/index.php" I get redirected correctly to the root index.php.
Do I have to change any code in the login.php? I'm constantly learning but I'm not good enough to understand every process/line in the login.php
Edit: I activated the web-development tools of my Firefox and saw that my guess was correct (the standard user is redirected to the account.php and then to the index.php (because he doesn't have access to it)). The users/index.php isn't called while login in at all.