CodeIgniter Forums
error on function call - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: error on function call (/showthread.php?tid=79097)



error on function call - richb201 - 04-19-2021

I am seeing something strange here (or perhaps I am having a senior moment?) For some reason my call to 
passwordless_login_admin($email,$id);

is coming up with the error below. Can someone tell me what is going on? 



PHP Code:
TypeError

Message
Call to undefined function passwordless_login_admin()

Filename: /app/application/controllers/Users_start_login.php 


PHP Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require 
'vendor/autoload.php';


class 
Users_start_login extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->library('form_validation');
        $this->load->library('session');
        $this->load->helper(array('form''url'));
 
//       $this->load->database();
        $this->output->set_template('default3_passwordless');
        $this->_init();
    }

    private function _init()
    {
        $this->load->js('assets/themes/default/js/jquery-1.9.1.min.js');
        $this->load->js('assets/themes/default/hero_files/bootstrap-transition.js');
        $this->load->js('assets/themes/default/hero_files/bootstrap-collapse.js');
        //load up data needed for fa
        $_SESSION['apiKey'] = getenv('apiKey');
        $_SESSION['applicationID_survey'] = getenv('applicationID_survey');
        $_SESSION['applicationID_login'] = getenv('applicationID_login');
        $_SESSION['applicationID_admin_login'] = getenv('applicationID_admin_login');
        $_SESSION['applicationID_admin_register_login'] = getenv('applicationID_admin_register_login');  //this is for both register and login
        $_SESSION['emailTemplate'] = getenv('emailTemplate');
        $_SESSION['tenantID_survey'] = getenv('tenantID_survey');
        $_SESSION['tenantID_login'] = getenv('tenantID_login');

        $_SESSION['client'] = new FusionAuth\FusionAuthClient($_SESSION['apiKey'], "http://fusionauth:9011");
    }

    public function get_email()
    {
        $id=0;
        $email=html_escape($_POST['email']);
        passwordless_login_admin($email,$id);
    
        
if (isset($email)) {
            if (!filter_var($emailFILTER_VALIDATE_EMAIL)) {
                $emailErr "Invalid email format";
            }
        }
    }


    public function passwordless_login_admin($email,$id)
    {
        //start the passwordless
        
....

    } 



RE: error on function call - richb201 - 04-19-2021

I moved my form from the template to a view.I still have the same issue.
<form action="<?= base_url('/index.php/Users_start_login/get_email') ?>" method="POST">
<div class="field">
<label class="label">Email Address</label>
<div class="control">
<input id="email" name="email" class="input" type="email" placeholder="Type the email address">
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-link">Enter system</button>
</div>
</div>
</form>

I get to the method, get_email, through the form action. Then everything goes crazy.


RE: error on function call - vitnibel - 04-19-2021

Hi

you just missed $this->

PHP Code:
$this->passwordless_login_admin($email,$id);
        



RE: error on function call - richb201 - 04-19-2021

(04-19-2021, 06:51 PM)vitnibel Wrote: Hi

you just missed $this->

PHP Code:
$this->passwordless_login_admin($email,$id);
        
Thank you!.


RE: error on function call - vitnibel - 04-19-2021

I don't know why the debugger goes to this place.
But using values from $_POST is better through $request->getPost() is for sure


RE: error on function call - richb201 - 04-19-2021

Thanks. I switched over to    $email = $this->input->post('email');

and it still jumps to that same line in Codeigniter.php. strange.
* ------------------------------------------------------
*  Call the requested method
* ------------------------------------------------------
*/
  call_user_func_array(array(&$CI, $method), $params);

  // Mark a benchmark end point
  $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');    <<this line

/*


Thanks. Seems like a phpStorm issue. I switched on "waiting for debug connection" in the debugger, and the problem went away!


RE: error on function call - InsiteFX - 04-20-2021

This is telling me that your base_url is not configured right.

PHP Code:
<form action="<?= base_url('/index.php/Users_start_login/get_email') ?>" method="POST"
 
If you set your base_url to have an ending / slash like the documentation says to do you would not need a slash at the beginning
of index,php. Also if you need index.php then you should have used site_url not base_url.


RE: error on function call - hamishheney5 - 06-09-2021

I think you needed $this-> function on the last part of the code.


RE: error on function call - ashwinjio - 02-25-2022

I am having the same issue. I try to move the form from the template to view but still same error.  jiofi.local.html


RE: error on function call - dervisvid - 04-12-2022

i also think  using values from $_POST is better than $request->getPost() vidmate 2019  insta downloader