Welcome Guest, Not a member yet? Register   Sign In
coming in another doorway
#1
Tongue 
(This post was last modified: 12-02-2020, 01:54 PM by richb201.)

My app runs fine. It is using something called "passwordless" authentication. I send out emails to employees telling them that they should complete a survey and there is a link in the email for them to do this. An employee clicks on the link and if the email checks out as OK (within a time contraint) they get access to a particular function in my Controller. I have tested this and they get in there fine. The only thing my CI app knows about the guy who just entered is their email address. 

I now need to lookup that email address in one of my tables to get some other information about them. But I have found that coming in by that "side door" means that I don't have access to the database handle I have opened in database.php. Is there some way to communicate the dbase handle, like sticking it in a cookie? Will that work so i don't have to reopen it? One issue is that the main application that opened the dbase handle might not be running (like in the middle of the night). Any suggestions?

Since the proper database.php already exists (although it hasn't been initialized in this case), is there anyway to initialize it? I tried calling l$this->load->database(); but it couldn't find the command "load".  At a minimum, is there stuff I must load first? 
proof that an old dog can learn new tricks
Reply
#2

Where do you call $this->load->database()? From a controller or a library? If you're in a library, you need to call get_instance() before you can call "load". See this page of the user guide: https://www.codeigniter.com/userguide3/g...ur-library

PS: Since you're trying to call $this->load... I assume you're using CI3 and not CI4.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

Yes, I am using Ci3. What is happening is I am using fusionAuth which is first making sure that the user is authenticated and then forwarding to the function in a controller. In the controller My function looks like this:
function MyFormEmployees()
{
$report = new MyFormUserE;
$report->run()->render();
}
This is using KoolReport. MyFormUserE is php file where I build some dataStores using sql. Koolreport does automatically create a handle to the database, but I don't know how to use it to just get two fields. That is why I was trying to go directly to the table with the CI database class. I tried using get_instance(), but that seems to cause an internal server error 500 in fusionAuth.
proof that an old dog can learn new tricks
Reply
#4

(12-02-2020, 07:40 PM)richb201 Wrote: I tried using get_instance(), but that seems to cause an internal server error 500 in fusionAuth.

Ok, then post your code and the complete error message. Error 500 just mean it crashed.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#5

I managed to get it working. I am passing in the variable I need as a parameter in the URL.

thx
proof that an old dog can learn new tricks
Reply
#6

thank you so much
Reply




Theme © iAndrew 2016 - Forum software by © MyBB