Welcome Guest, Not a member yet? Register   Sign In
back to basics
#3

(This post was last modified: 11-16-2021, 04:02 AM by richb201.)

(11-15-2021, 03:17 PM)includebeer Wrote: Post your controller and your routes' configuration. There's no reason index() would be called for every routes but only the one configured to call index().

Here is routes.php:

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

$route['default_controller'] = 'Configure';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['registration'] = 'registration';
$route['login'] = 'login';
$route['subit_backend']['GET']='subit_backend/register'
and here is config.php:

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');
$config['base_url'] = 'http://staging.researchstudyonline.com:8181/';
$config['index_page'] = 'index.php';    //only for ubuntu
$config['uri_protocol'] = 'PATH_INFO';        // 5/20/20
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = TRUE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FCPATH 'vendor/autoload.php';    //for ubuntu
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = TRUE;
$config['access_token'] = '#';
$config['allow_get_array'] = TRUE;
$config['log_threshold'] = 4;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';

$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = '';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'cisession';
$config['sess_expiration'] = 28800;  // this is 8 hours, every 8 hours the session will be destroyed and when it does the user will be logged off
have any activity in 30 minutesthey will log off via javascript_funcs.js
$config
['sess_save_path'] = APPPATH.'cache';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = ''
And here is the top of the controller, Configure.php:

PHP Code:
class Configure extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper(array('form''url''file''array','download','directory'));
        $this->load->library('grocery_CRUD');
        $this->load->library('email');
        $this->load->library('image_lib');
        $this->load->library('image_CRUD');
        $this->load->library('ftp');
        $this->load->library('form_validation');
        $this->load->helper('cookie''download');
        $this->load->model('MyModel');
        $this->load->js("/js/javascript_funcs.js");
        $this->_init();
    }


    private function _init()
    {
        $this->output->enable_profiler(FALSE);  //turn on profiler
        //this sets all the credentials into session
        $this->session->set_userdata('LOCAL'getenv('LOCAL'));
        $this->session->set_userdata('AWS_ACCESS_KEY_ID'getenv('AWS_ACCESS_KEY_ID'));
        $this->session->set_userdata('AWS_SECRET_ACCESS_KEY'getenv('AWS_SECRET_ACCESS_KEY'));
        $this->session->set_userdata('hostname'getenv('hostname'));
        $this->session->set_userdata('username'getenv('username'));
        $this->session->set_userdata('password'getenv('password'));
        $this->session->set_userdata('connectionString'getenv('connectionString'));
        $this->session->set_userdata('key'getenv('key'));
        $this->session->set_userdata('secret'getenv('secret'));
        $this->session->set_userdata('onetime'0);
        $_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['client'] = new FusionAuth\FusionAuthClient($_SESSION['apiKey'], "http://fusionauth:9011");
        //sendpulse section
        $_SESSION['sendpulse_API_USER_ID'] = getenv('sendpulseID');
        $_SESSION['sendpulse_SECRET'] = getenv('sendpulseSecret');
        $_SESSION['stripe_SECRET'] = getenv('stripe_secret_key');
$_SESSION['sendpulse_SECRET'], new FileStorage());
        $this->session->set_userdata('iTransfered',0);
        $this->db->where('email'$this->session->userdata('userid'));
        $this->db->where('company_division'$this->session->userdata('campaign'));
        $query $this->db->get('campaigns2');
        $row $query->result();
        if (!isset($row[0])) {    //not found so get the first one
            $this->db->where('email'$this->session->userdata('userid'));
            $query $this->db->get('campaigns2');
            $row $query->result();
        }

        if (!isset($row[0]->type))
            $row[0]->type 0;          //if not set make is into generic

        //set the premium support flag
        if ($row[0]->premium_support==1)
              $_SESSION['premium_support']=1;
        $this->MyModel->counts_for_three_way();
        //set this to software or pharma or generic or defense
        $this->output->set_template('default2');
        $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');
        $this->load->js('js/jquery.orgchart.js');    // for charts
        $testhost getenv('TESTHOST');
        $this->MyModel->update_risk();  //do this everytime a user logs in
        $this->create_cubby();    //attempt to create cubbys for this person
    }

    public function _configure_output($output null)
    {
        $GLOBALS['title'] = "Research Credit Online";
        $this->load->view('configure.php', (array)$output);
    }

    public function index()
    {
        $this->_configure_output((object)array('output' => '''js_files' => array(), 'css_files' => array()));
        $this->_example_output((object)array('output' => '''js_files' => array(), 'css_files' => array()));

        if ($this->session->userdata('onetime')!=1)
        {
            $this->session->set_userdata('onetime'1);
            //load the dashboard
            $this->report_generator_amazing();    <<this displays the dashboard 
            
//load the images
            $this->get_from_locker();  //bring down this guy's images from s3
      }
    
proof that an old dog can learn new tricks
Reply


Messages In This Thread
back to basics - by richb201 - 11-13-2021, 11:30 AM
RE: back to basics - by includebeer - 11-15-2021, 03:17 PM
RE: back to basics - by richb201 - 11-16-2021, 03:54 AM
RE: back to basics - by includebeer - 11-16-2021, 04:55 AM
RE: back to basics - by richb201 - 11-16-2021, 05:31 AM
RE: back to basics - by includebeer - 11-17-2021, 06:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB