Welcome Guest, Not a member yet? Register   Sign In
user login error
#1

[eluser]learning_php[/eluser]
Hi,

i am trying to create a user login and but when i click the login button nothing happens? I have the following model,controller and form:

model:
Code:
class MAdmins extends Model {

    function MAdmins(){
        parent::Model();
    }
    
    function verifyUser($u,$pw){
        $this->db->select('id','username');
        $this->db->where('username',$u);
        $this->db->where('password',$pw);
        $Q = $this->db->get('members');
        
        if ($Q->num_rows()>0){
            $row = $Q->row_array();
            $_SESSION['userid']=$row['id'];
            $_SESSION['username']=$row['username'];
        }else{
            $this->session->set_flashdata('error','sorry, your username or password is incorrect!');
        }
    }
    
    
}

controller:
Code:
function verify(){
            if ($this->input->post('username')){
                $u = $this->input->post('username');
                $pw=$this->input->post('password');
                $this->MAdmins->verifyUser($u,$pw);
                if($_SESSION['userid']>0){
                    redirect('gallery','refresh');
                }
            }
            $this->load->view('test_view');
            
        }

form:

Code:
<?PHP
                    if($this->session->flashdata('error')){
                        echo "<div class = message>";
                        echo $this->session->flashdata('error');
                        echo "</div>";
                    }
                    ?&gt;
                    &lt;?PHP
                    $udata = array('name'=>'username','id'=>'u');
                    $pdata = array('name'=>'password','id'=>'p');
                    
                     form_open("homepage/verify");
                     echo"<P><label for='u'>Username:</label><br />";
                     echo form_input($udata) . "</P>";
                       echo"<P><label for='p'>password:</label><br />";
                     echo form_password($pdata) . "</P>";
                     echo form_submit('submit','login');
                     echo form_close();
                     ?&gt;


Messages In This Thread
user login error - by El Forum - 04-24-2009, 07:43 AM
user login error - by El Forum - 04-24-2009, 08:14 AM
user login error - by El Forum - 04-24-2009, 08:20 AM
user login error - by El Forum - 04-24-2009, 08:25 AM
user login error - by El Forum - 04-24-2009, 11:59 AM
user login error - by El Forum - 04-24-2009, 12:30 PM
user login error - by El Forum - 04-24-2009, 12:45 PM
user login error - by El Forum - 04-24-2009, 01:44 PM
user login error - by El Forum - 04-24-2009, 02:21 PM
user login error - by El Forum - 04-24-2009, 02:27 PM
user login error - by El Forum - 04-24-2009, 02:36 PM
user login error - by El Forum - 04-24-2009, 02:49 PM
user login error - by El Forum - 04-24-2009, 03:04 PM
user login error - by El Forum - 04-26-2009, 01:16 AM
user login error - by El Forum - 04-26-2009, 05:01 AM
user login error - by El Forum - 04-27-2009, 09:26 AM
user login error - by El Forum - 04-27-2009, 09:37 AM
user login error - by El Forum - 04-27-2009, 09:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB