Source

myswap / 1 / code / App / Lib / Model / UserModel.class.php

Full commit
<?php
class UserModel extends Model{
	protected $fields = array(
	'user_id', 
	'username', 
	'email', 
	'password',
	'friends',
	'userAliases',
	'_pk'=>'user_id',
	'_autoinc'=>true
	);
	private function _c($s){
		$mysql = new SaeMysql();
		return $mysql->escape($s);
	}
	public function getById($user_id)
	{
	$user_id=$this->_c($user_id);
	return  $this->query("select * from __TABLE__ where user_id='$user_id'");
	}
	public function getByUsername($username)
	{
	$username=$this->_c($username);
	$username=strtolower($username);
	return  $this->query("select * from __TABLE__ where username='$username'");
	}
	public function have_username($username)
	{
	$username=$this->_c($username);
	$username=strtolower($username);
	return  $this->query("select * from __TABLE__ where username='$username'");
	}
}
?>