Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] New Error
#1

(This post was last modified: 08-17-2016, 07:29 PM by davy_yg.)

Hello,

Fatal error: Cannot redeclare Mpages::call_gallery() in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\models\Mpages.php on line 152
A PHP Error was encountered
Severity: Compile Error
Message: Cannot redeclare Mpages::call_gallery()
Filename: models/Mpages.php
Line Number: 152
Backtrace:

I am facing this strange error message from my CI program.  Maybe someone can help me out!

I type this:


http://127.0.0.1/CompanyGiondaCI/

I expect my login page would comes out.  It seems there is a missing link between the url I type and the program that I appears.


config/routes.php

PHP Code:
$route['default_controller'] = 'cpages/login'

views/login.php

PHP Code:
<?php $this->load->library('form_validation'); ?>
                        
<?php echo validation_errors(); ?>
                        
<?php echo form_open('cpages/ceklogin'); ?>
                        
<div class="login-card">
    <h2>Gionda CMS Login</h2><br>
  <form>
    <div class="login"><input type="text" name="username" placeholder="Username"></div>
    <div class="login"><input type="password" name="password" placeholder="Password"></div>
    <br>
    <input type="submit" name="login" class="login login-submit" value="login">
  </form>

  <div class="login-help">
    <a href="#">Register</a> • <a href="#">Forgot Password</a>
  </div>
</div> 


Controllers/Cpages.php

PHP Code:
public function ceklogin() {
        
        
$username $this->input->post('username'TRUE);
        
$password $this->input->post('password'TRUE);
        
$this->db->where('username'$username);
        
$this->db->where('password'$password);
        
$query=$this->db->get('login');
        if (
$query->num_rows() == 1)
            {
                
// echo 'LOGIN BERHASIL !';
                
                
$this->load->model('Mpages');
                
$data['login']=$this->db->get('login');
                
$data['login'] = $this->Mpages->login();
                
$this->load->view('index'$data);
            }
        else
            {
                
// echo 'LOGIN GAGAL !';
                
$data['warning']='Your username and password are wrong !';
                
$this->load->view('login'$data);
            }            
        
    } 
" If I looks more intelligence please increase my reputation."
Reply
#2

(This post was last modified: 08-17-2016, 03:59 AM by wolfgang1983.)

(08-13-2016, 10:55 PM)davy_yg Wrote: Hello,

Fatal error: Cannot redeclare Mpages::call_gallery() in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\models\Mpages.php on line 152
A PHP Error was encountered
Severity: Compile Error
Message: Cannot redeclare Mpages::call_gallery()
Filename: models/Mpages.php
Line Number: 152
Backtrace:

I am facing this strange error message from my CI program.  Maybe someone can help me out!

I type this:


http://127.0.0.1/CompanyGiondaCI/

I expect my login page would comes out.  It seems there is a missing link between the url I type and the program that I appears.


config/routes.php

PHP Code:
$route['default_controller'] = 'cpages/login'

views/login.php

PHP Code:
<?php $this->load->library('form_validation'); ?>
                        
<?php echo validation_errors(); ?>
                        
<?php echo form_open('cpages/ceklogin'); ?>
                        
<div class="login-card">
    <h2>Gionda CMS Login</h2><br>
  <form>
    <div class="login"><input type="text" name="username" placeholder="Username"></div>
    <div class="login"><input type="password" name="password" placeholder="Password"></div>
    <br>
    <input type="submit" name="login" class="login login-submit" value="login">
  </form>

  <div class="login-help">
    <a href="#">Register</a> • <a href="#">Forgot Password</a>
  </div>
</div> 


Controllers/Cpages.php

PHP Code:
public function ceklogin() {
        
        
$username $this->input->post('username'TRUE);
        
$password $this->input->post('password'TRUE);
        
$this->db->where('username'$username);
        
$this->db->where('password'$password);
        
$query=$this->db->get('login');
        if (
$query->num_rows() == 1)
            {
                
// echo 'LOGIN BERHASIL !';
                
                
$this->load->model('Mpages');
                
$data['login']=$this->db->get('login');
                
$data['login'] = $this->Mpages->login();
                
$this->load->view('index'$data);
            }
        else
            {
                
// echo 'LOGIN GAGAL !';
                
$data['warning']='Your username and password are wrong !';
                
$this->load->view('login'$data);
            }            
        
    } 


I noticed you have not set your base url.  This is why ip address is showing in url when submit form may run in to issues if not set.

You have also loaded your form validation wrong you have loaded it in view you should load it like so.

http://www.codeigniter.com/user_guide/li...controller

Also in codeigniter 3 versions the default controller in routes does not work in subfolders.

And models load like http://www.codeigniter.com/user_guide/ge...of-a-model

And controllers http://www.codeigniter.com/user_guide/ge...ello-world
 
Also you seem to be asking a lot of questions  I would suggest read through the entire user guide.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB