Welcome Guest, Not a member yet? Register   Sign In
Website Architect Arrangement
#1

[eluser]Unknown[/eluser]
Hi All,

I had a simple question about the coding pattern.

controller/index.php
controller/register.php
views/header.php
views/index.php
views/register.php
views/footer.php

Normal case
controller/index.php
Code:
$this->load->view('index');

views/index.php
Code:
<?php require_once "header.php" ?>
......
<?php require_once "footer.php" ?>

but my views/header.php including a login/password fields and validate at controller/index.php
Code:
public function chkmember()
{

  $username = $this->input->post("login1");
  $password = $this->input->post("pwd1");
  
  $this->load->model('data_model');
  $pass   = $this->data_model->getMember($username, $password);

  if ($pass != 0) {
   foreach ($pass as $p) {
    $this->session->set_userdata('username', $p->login);
    $this->session->set_userdata('mid', $p->Mid);
   }
   redirect('index');
  } else {
   redirect(base_url());
  }
}

that is the problem, if we visit the register.php page, it also include the views/header.php and views/footer.php, but the controller/register.php did't code the chkmember function, did i need to change the code to public function to elimitate the problem?

thank you for your help. Thanks.





Theme © iAndrew 2016 - Forum software by © MyBB