The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
switching index.php
#4
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>
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();
?>
</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.
  Reply


Messages In This Thread
switching index.php - by dsuggs - 11-29-2017, 04:42 PM
switching index.php - by mudmin - 11-29-2017, 07:45 PM
switching index.php - by dsuggs - 12-15-2017, 06:53 PM
switching index.php - by s.farg - 02-13-2018, 01:22 PM
switching index.php - by mudmin - 02-13-2018, 03:54 PM
switching index.php - by s.farg - 02-13-2018, 04:17 PM
switching index.php - by mudmin - 02-13-2018, 04:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)