Welcome Guest, Not a member yet? Register   Sign In
Disallowed Key Characters: Array
#1

[eluser]Nathan Payne[/eluser]
I am having a problem with a login script I am making.

I am getting the following when I enter the username and password: Disallowed Key Characters: Array

Code:
Controller:
Code:
<?php
    
    class Admin extends Controller{
        
    function Admin()
    {
        parent::Controller();
    }
    
    function index()
    {
        $this->load->model('admin_model', '', TRUE);
        
        $this->layout->view('login');
    }
    
    function verify()
    {
        if ($this->input->post('username')){
            $username = $this->input->post('username');
            $password = $this->imput->post('password');
            
            $this->admin_model->authorize($username, $password);
            if ($_SESSION['userid'] > 0){
                redirect('admin/dashboard','refresh');
            }
        }else
        {
            $this->layout->view('login');
        }
    }}?>

Model:
Code:
<?php

    class Admin_model extends Model{
        
        function Admin_model(){
            parent::Model();
        }
        
        function authorize($username, $password){
            $data = array();
            $this->db->select('id, username');
            $this->db->where('username', $username);
            $this->db->where('password', $password);
            $this->db->limit(1);
            
            $q = $this->db->get('users');
            if ($q->num_rows() > 0){
                $row = $q->row_array();
                $_SESSION['userid'] = $row->id;
                $_SESSION['username'] = $row->username;
            }else{
                $this->session->set_flashdata('error', 'Your login details failed!');
            }
        }
                
        }

View:
Code:
<div id="content">
    <h1>Admin Login</h1>
    &lt;?php if ($this->session->flashdata('error'))
    {
        echo $this->session->flashdata('error');
    }
    ?&gt;
    &lt;?php
    $username = array('name' => 'username', 'id' => 'username', 'size' => 20);
    $password = array('name' => 'password', 'id' => 'password', 'size' => 20);
    
    echo form_open("admin/authorize");
    echo "<p><label for='username'>Username</label><br />";
    echo form_input($username . "</p>");
    echo "<p><label for='password'>Password</label><br />";
    echo form_password($password . "</p><br />");
    echo form_submit('submit', 'login');
    echo form_close();
    ?&gt;
    
    
</div></div>

<div id="sidebar">
    <div id="latesthouse">
        <h1>Latest Houses</h1>
        <h2>Amityville Horror</h2>
            <p class="latesthouse"><img class="latesthouse" src="&lt;?php echo base_url().'images/amityville.jpg'; ?&gt;"
        alt="Amityville House" />The Amityville Horror is one of the most documented
        and well-known cases of a haunted house in the history of paranormal research.
        
        </p>
    </div>

Any help would be great thanks.
#2

[eluser]Nathan Payne[/eluser]
I have fixed it now, seems like when I leave it for a bit then come back I see my error in seconds lol.
#3

[eluser]Muser[/eluser]
I'm having the same trouble...

When I submit a Form I get a blank page with "Disallowed Key Characters" message

How you've solved it?
#4

[eluser]Muser[/eluser]
Haha I solved in a while... Ouch!

I had a select html tag with an invalid name attribute Tongue




Theme © iAndrew 2016 - Forum software by © MyBB