Welcome Guest, Not a member yet? Register   Sign In
Custom Helper Problem ?
#1

Hi guys.
Who can help me solve a problem?
I made a helper in the CI3 standard but I displays the following error message:

An uncaught Exception was encountered
Type: Error
Message: Using $this when not in object context
Filename: /var/www/Dropbox/screens.dev/public_html/application/helpers/sessdata_helper.php
Line Number: 71
Backtrace:
File: /var/www/Dropbox/screens.dev/public_html/application/controllers/apps/Runcode.php
Line: 35
Function: check

File: /var/www/Dropbox/screens.dev/public_html/index.php
Line: 315
Function: require_once


Helper : sessdata_helper.php:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');



  if ( ! function_exists('check')) {

    //

    function check($ws_safe_email) {

      //get main CodeIgniter object

      $ci =& get_instance();

      //load databse library

      $ci->load->database('screens.db', TRUE);

      // data decode and execute search in columm

      $ci->db->where('ws_safe_email', base64_decode($ws_safe_email));

      // Open table for search

      $ws_user_list = $ci->db->get('ws_screens')->result();

      //

      if  (count($ws_user_list)==1) {

        // atribui resultado da consulta dentro de um array relacionada a varaiavel:

        $ws_session_data['ws_user_list'] = $ws_user_list[0];

        // atribui valor bolean

        $ws_session_data['logado'] = TRUE;

        // abre a session

        $this->session->set_userdata($ws_session_data);

        // recupera o valor decodificado de acesso e atribui dentro de um array relacionado a variavel:

        $data['ws_safe_email'] = $this->session->userdata('ws_user_list')->ws_safe_email;

        // obten o feedback:

        return $data;

      }

      //

      elseif ($ws_safe_email == '') {

        // restricted access

        //$url = "http://access.webstrucs.com/";

        //header("Location: $url" );

        echo "Acesso restrito";

      }

    }
  }

Controller : Runcode.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Runcode extends CI_Controller {

// Contructor Method :
 public function __construct() {
parent::__construct();
}

 public function index() {
}

 public function accesscheck($ws_safe_email) {
$this->load->helper('sessdata');
$feedbk = check($ws_safe_email);
echo $feedbk;
  }
  public function accessclose() {
  }
}

???

Reply


Messages In This Thread
Custom Helper Problem ? - by jocm.aguiar - 07-11-2016, 06:45 PM
RE: Custom Helper Problem ? - by HTLove - 07-11-2016, 07:14 PM
RE: Custom Helper Problem ? - by InsiteFX - 07-12-2016, 04:42 AM
RE: Custom Helper Problem ? - by jocm.aguiar - 07-12-2016, 01:23 PM
RE: Custom Helper Problem ? - by mwhitney - 07-12-2016, 02:23 PM
RE: Custom Helper Problem ? - by jocm.aguiar - 07-12-2016, 06:53 PM
RE: Custom Helper Problem ? - by InsiteFX - 07-12-2016, 07:06 PM
RE: Custom Helper Problem ? - by jocm.aguiar - 07-14-2016, 10:21 AM
RE: Custom Helper Problem ? - by InsiteFX - 07-14-2016, 10:50 AM
RE: Custom Helper Problem ? - by jocm.aguiar - 07-14-2016, 01:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB