Welcome Guest, Not a member yet? Register   Sign In
Case insensitive login class
#1

[eluser]Kurai[/eluser]
Hi there!
I'm building my own login class inside my application. I used Simple login just to learn the mechaniscs and the basic structure, and I have two questions.

First one: is really ok to have all the check routines (which of course involve the database) in a library? Shouldn't be better to use a model instead?

Second one: simplepie checks if the username exists in the database this way:
Code:
$this->CI->db->where('username', $user);
$query = $this->CI->db->getwhere($this->user_table);

Which is obviously good if you want a case-sensitive login. What if I'd like to have username put into the database as is, but case-insensitive control? Thank you!
#2

[eluser]adamp1[/eluser]
1. I personally wouldn't have the database calls in the library. Yes have the check routines in the library but call functions in the model.

2. By default, MySQL searches are not case sensitive. So a search for 'item' will return 'item' AND 'Item'.
#3

[eluser]Tom Glover[/eluser]
Quote:1. I personally wouldn't have the database calls in the library. Yes have the check routines in the library but call functions in the model.

2. By default, MySQL searches are not case sensitive. So a search for 'item' will return 'item' AND 'Item'.

How then would you make a MySQL search case-sensitive?


EDIT: Non Related but your second signature link does not work.
Quote:http://code.google.com/p/backendpro/
Doesn't Exist / 403 Forbidden
#4

[eluser]adamp1[/eluser]
Quote:By default, MySQL searches are not case sensitive. This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a. If you want to make this search case sensitive, make sure that one of the operands has a case sensitive or binary collation. For example, if you are comparing a column and a string that both have the latin1 character set, you can use the COLLATE operator to cause either operand to have the latin1_general_cs or latin1_bin collation. For example:

Code:
col_name COLLATE latin1_general_cs LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_general_cs
col_name COLLATE latin1_bin LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_bin

More information can be found here and here

Hope that helps




Theme © iAndrew 2016 - Forum software by © MyBB