Welcome Guest, Not a member yet? Register   Sign In
error on function call
#1

(This post was last modified: 04-19-2021, 06:39 AM by richb201.)

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
        
....

    } 
proof that an old dog can learn new tricks
Reply
#2

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.
proof that an old dog can learn new tricks
Reply
#3

Hi

you just missed $this->

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

(This post was last modified: 04-19-2021, 09:39 PM by richb201.)

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

you just missed $this->

PHP Code:
$this->passwordless_login_admin($email,$id);
        
Thank you!.
proof that an old dog can learn new tricks
Reply
#5

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

(This post was last modified: 04-19-2021, 10:21 PM by richb201.)

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!
proof that an old dog can learn new tricks
Reply
#7

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8

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

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

(This post was last modified: 04-15-2022, 03:33 AM by dervisvid.)

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




Theme © iAndrew 2016 - Forum software by © MyBB