Page 1 of 1

problem with check_login function

Posted: Tue Oct 19, 2010 1:43 pm
by free_programmer
Hello
this is my first post here,I use CMSMS since 2008.
I upgraded the website from version 1.2.3 to 1.8.1 and it went smoothly except for a small issue which is:
I have an external page for job where I use check_login() function to make sure the user already loged in,but it keeps redirect to the login page,when I enabled the debug to see the output it works (I can run the page ) and the debug output say:
Debug display of 'End of include':(0.086686) - (8497144)
Debug: (0.087416) - (8474200)

Session found.  Moving on...

It used to work perfectly before upgrading,I don't know what is the problem?
the full code for the page is attached,any hint is welcome :)

Re: problem with check_login function

Posted: Tue Oct 19, 2010 5:36 pm
by NaN
Function check_login() without any params will always redirect to the login page if user is not logged in.
You need to pass true (boolean) to prevent redirecting.
But this means, that your script will also be processed if the user is not logged in.

Re: problem with check_login function

Posted: Wed Oct 20, 2010 5:19 am
by free_programmer
thank you but in my case even when the user already loged in its redirect to the log in,the check_login() is returning true!!  ??? I can't pass true to the function , bc this will allow unauthorised users to see the script.

I don't what changed since 1.2.3 for this function

Re: problem with check_login function

Posted: Wed Oct 20, 2010 6:18 am
by gdur
Hi,

It's not clear but I guess this is about FEU.
This might help you:
{if $ccuser->loggedin()} (this can be refined with {|$ccuser->memberof ('name of group')})
place here the link to the external page
{else}
{redirect to='login'} (where redirect is a Smarty tag and login the alias of the login page).
{/if}

Keep in mind though that this only provides would be security. If the real url is known this can be easily bypassed.