View Single Post
Old 11-22-2007, 03:08 PM   #5 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,053
Thanks: 115
Tanax is on a distinguished road
Default

So.. would this be a good way??

php Code:
public function user_check($user_name, $user_pass) {
           
            $sql = sprintf("    SELECT
                                    `%s`
                                FROM
                                    `%s`
                                WHERE
                                    `%s` = '%s' AND `%s` = '%s'
                                LIMIT 1"
,
                               
                                $this->db->col['user_id'],
                                $this->db->table['users'],
                                $this->db->col['user_name'],
                                $user_name,
                                $this->db->col['user_pass'],
                                md5(CONCAT($this->db->col['user_salt'], $user_pass)));
                               
            $query = $this->db->query($sql);
           
            if(mysql_num_rows($query)) {
               
                $user_info = $this->db->fetch($query);
               
                return $user_info['user_id'];
               
            }
           
            else {
               
                return false;
               
            }

(please make the highlight thing work so you only have to write [ php ] code [ / php ] :( )


EDIT: I know I haven't secured it .. but I'm not done with that yet ;)
Tanax is offline  
Reply With Quote