Welcome Guest, Not a member yet? Register   Sign In
Form Post and Library Redeclare problem
#3

[eluser]monkeypaw201[/eluser]
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Account {

    function login($username,$password)
    {
        $this->CI =& get_instance();
        
        $query = $this->CI->db->query("SELECT * FROM `clients` WHERE `username` = '".$username."' AND `password` = '".sha1($password)."'");
        if ($query->num_rows() > 0)
        {
            $row = $query->row();
            $this->CI->session->set_userdata('client_id', $row->client_id);
            return TRUE;
        }else{
            return FALSE;
        }
    }

    function logout()
    {
        $this->CI =& get_instance();
        $this->CI->session->unset_userdata('client_id');
    }

    function data($column='username')
    {
        $this->CI =& get_instance();
        $client_id = $this->CI->session->userdata('client_id');
        
        $query = $this->CI->db->query("SELECT * FROM `clients` WHERE `client_id` = '".$client_id."'");
        $row = $query->row_array();
        return $row[$column];
    }

    function notices()
    {
        $this->CI =& get_instance();
        $client_id = $this->CI->session->userdata('client_id');
        
        $query = $this->CI->db->query("SELECT * FROM `notices` WHERE `client_id` = '".$client_id."' AND `read` = '0'");
        $output = '<div class="pad20">';
        foreach ($query->result() as $row)
        {
            $output .= '<div class="message '.$row->type.' close" id="'.$row->notice_id.'">
                            <h2>'.$row->title.'!</h2>
                            <p>'.$row->message.'</p>
                        </div>';
        }
        $output .= '</div>';
        return $output;
    }
    
    function update($column,$value)
    {
        $this->CI =& get_instance();
        $client_id = $this->CI->session->userdata('client_id');
        
        $query = $this->CI->db->query("UPDATE `clients` SET `".$column."` = '".$value."' WHERE `client_id` = '".$client_id."' LIMIT 1");
    }

}

?&gt;


Messages In This Thread
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 10:49 AM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 12:19 PM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 05:27 PM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 06:37 PM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 08:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB