Control which page displays first

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sticcino
User
Posts: 1090

Control which page displays first

Post by sticcino »

is there any way to not have the anonymous page get displayed if the main site is being called as mysite.com?

mysite.com/ -- should display the login page...

but now that we added an anon page, the anon page gets displayed regardless of the default page that was setup.
the anon page is being emailed to users as mysite.com/anonpage

is this something/somewhere we can add a check?, we can't control (or we don't want to tell users they "have to" add the /login - as users don't listen)

thanks,


arbei
User
Posts: 9787

Post by arbei »

  1. Assume you use Custom File, make sure the Custom File is not set as Default in Table Setup page, (or it is not the first "table" and you have no default table)
  2. Make sure you have set a correct Start Page.

sticcino
User
Posts: 1090

Post by sticcino »

those are set,
what i now did was set the start page to login, i had it set to my dashboard page, this seems to have rectified the problem

thanks


sangnandar
User
Posts: 1031

Post by sangnandar »

For future reference, the order is as follow:

  1. Start Page -> set during generation
  2. If Start Page is empty, then Default Page -> set in Table Setup
  3. If Start Page and Default Page are empty, then First Table -> this is <table>list.php where <table> is the first table of the user's userlevel have permission to access -> set in userlevelpermissions table.

sticcino
User
Posts: 1090

Post by sticcino »

i thought it was working but it continues to display the anonymous file first, if I just hit mysite as:

localhost/myapp
displays the anonymous form

if i do:

localhost/myapp/login

then the login page will appear

i even tried setting another table as the default, it always goes directly to the anonymous page
even if i enter localhost/myapp/index, it redirects to the anonymous page

I have to explicitly enter "login" or another table after the host site


arbei
User
Posts: 9787

Post by arbei »

If you created your "anonymous form" by Custom File, it will be treated like a table. As said, make sure the Custom File is not set as Default in Table Setup page, (or it is not the first "table" and you have no default table).

If the user does not have permissions to go to other page, the user will be redirected to first page allowing anonymous user, so you may need to arrange the order of the tables in the Table Setup page. If your "anonymous form" is the only page allowing anonymous user, the user will be redirected to the page anyway. You may use Page_Load server event to check and redirect user to the login page.


sangnandar
User
Posts: 1031

Post by sangnandar »

You might want to debug the url using Log(), in controllers\OthersController.php under function index().


sticcino
User
Posts: 1090

Post by sticcino »

not sure but it appears the code is checking the permissions table first, i removed the form from -2 and the system went back to normal, set the form as -2 and it went straight to the anon form. It appears its not checking the url so i assume its just defaulting to any anon forms first, and not saying hey there's no form in the URL default to the specified "start page" which is set to dashboard2 which is does not, even the "default" in tables is checked and not followed.

i would of assumed:

localhost/myapp/

-> no table....
->check start page not blank - goto it, if blank...
->check "default" table selected - goto it, if blank
-> no start or default pages set? ->goto login page

should not automatically default to an anonymous page if there is no table specified, just because its anonymous doesn't mean it should be displayed, i think the code is not following its own logic.
in the start page it appears to listen to it, but if I enter the page I want it's not displayed - goes to the anon page, if I put login as the start page...works... but obviously it puts the code into a loop

strange...


arbei
User
Posts: 9787

Post by arbei »

arbei wrote:

If the user does not have permissions to go to other page, the user will be redirected to first page allowing anonymous user

If you want custom flow, you may write your own function in Global Code, then enter your function name as the Start Page.


sangnandar
User
Posts: 1031

Post by sangnandar »

Be aware that:

  • BEFORE login, everyone are anon (UserLevel = -2)
  • UserLevel other than -2 (non anon) is assigned AFTER login

Hence:

  • check your start-page/default-page permissions, do UserLevel = -2 have access to these pages?
  • if your start-page/default-page are unreachable by anon, surely they will always go for first-table (that is your custom file)

sangnandar
User
Posts: 1031

Post by sangnandar »

I've just checked, setting Start Page to login.php won't work, because login.php don't exist in global $USER_LEVEL_TABLES (probably because it's actually user table).
I think the only way to solve your problem is as arbei's suggestion.

arbei wrote:

If you want custom flow, you may write your own function in Global Code, then enter your function name as the Start Page.


arbei
User
Posts: 9787

Post by arbei »

Start Page is a route, e.g. login, not a file (not login.php).


Post Reply