The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
ft_api_login - permission problem - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: ft_api_login - permission problem (/showthread.php?tid=633) |
ft_api_login - permission problem - Hannes - Apr 4th, 2010 I have a client (username/passwort) whom i want to login automatically. Therefore I'm using the following script: PHP Code: <?php The client is logged in and the client_form page appears but as soon as I click to view submissions of a form I'm logged out with the error message: Quote:You do not have the permissions to access this page. You have been logged out. Please advise me what the problem is. best regards, Hannes RE: ft_api_login - permission problem - Ben - Apr 4th, 2010 Hi Hannes, That should work... but try this instead. The ft_api_start_sessions function is really just for API forms. PHP Code: <?php Note, index.php will have to have those session_start() lines at the top as well, otherwise sessions will be lost before the user attempts to log in. All the best - Ben RE: ft_api_login - permission problem - Hannes - Apr 4th, 2010 same thing happens: when I login and logout the conventional way before going to this page it works. But just running this script I don't have the permission. RE: ft_api_login - permission problem - Ben - Apr 9th, 2010 Hey Hannes, That's weird, I tested it out myself and it works okay. So just to double check: every page that you go to AFTER logging in via the script and BEFORE linking to a Form Tools page has the session_start() stuff on it, correct? Try this: add a little code to that page (or pages) to confirm that the login information is still in sessions. PHP Code: <?php print_r($_SESSION["ft"]); ?> That should output a whole thwack of information about the user who just logged in. If it doesn't output anything (just "Array( )") then we know that the sessions aren't being stored properly and that's why Form Tools is booting you out. - Ben RE: ft_api_login - permission problem - Hannes - Apr 9th, 2010 Hey Ben, thank you a lot for your efforts. by the session_start() stuff you mean those lines? PHP Code: require("../../global/session_start.php"); Did you login as administrator the session before? Don't ask me why but that's the only case the script works on my installation - if it's not the case i still get the error message. when printing the session information it shows correctely Code: ...[account] => Array ( [account_id] => 2 [account_type] => client [account_status] => active [ui_language] => en_us [timezone_offset] => 0 [sessions_timeout] => 30 [date_format] => M jS y, g:i A [login_page] => client_forms [theme] => default [menu_id] => 2 [first_name] => user [last_name] => name [email] => user@name.de [username] => username [password] => 696d29e0940a4957748fe3fc9efd22a3... When logging in the conventional way the client has the permission to view this form... best regards, Hannes RE: ft_api_login - permission problem - Ben - Apr 10th, 2010 Ah - first off, I wouldn't modify the core script. That won't be needed at that point anyway - the pages all start with the session_start(), so the following 3 lines you posted are just duplicates. But no, I actually meant that any pages outside of Form Tools that you're users who login via the form are going to be navigating to before eventually ending up on a Form Tools page need to have those session_start lines. If you're royally stuck, email me at ben.keen@gmail.com with your FTP info, a link to your api login form and a description of which pages the user will go to prior to going to Form Tools. I could then debug the problem directly. - Ben RE: ft_api_login - permission problem - Hannes - Apr 10th, 2010 Hi Ben, thank you a lot for your effort. but I still don't get it... there is no external file involved in this:
but...
Did I miss any step? best regards, Hannes. RE: ft_api_login - permission problem - Ben - Apr 10th, 2010 Hi Hannes, I tried that code and it actually works fine for me. One thing: remove the very first require() line. PHP Code: require("global/session_start.php"); That's not needed, but it shouldn't cause an error... You mentioned you created that file at the following location: forms/show.php. Is the /forms folder the Form Tools root folder (i.e. the folder with the main login form for the script?) If so, that's correct. Are you running 1.0.0 of the API, btw? If not, download it! http://docs.formtools.org/api I must say, I'm kind of stumped on this... it should work - it certainly does on my installation. - Ben RE: ft_api_login - permission problem - Hannes - Aug 8th, 2011 Update: I just found this thread again because I needed the autologin feature again and wanted to confirm that it was the first line which is causing the error. The way Ben wrote it is also working in 2.1: PHP Code: <?php |