I have created the following code for a login which is working fine, but I would like it to be case sensitive but canot figure out how to do so.
I have tried adding 'COLLATE latin1_bin' into the code but not sure I had put it in right.
$err_msg_login = '';
$err_msg_login = $_REQUEST['msg_err'];
if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'checkLogin')
{
if(isset($_REQUEST['rbType']))
{
if($_REQUEST['rbType']=='user')
{
$qry_select_usereg = "SELECT * FROM user_registration WHERE user_name = '".$_REQUEST['txtUserName']."' AND password = '".$_REQUEST['txtPassword']."' AND status = '1'";
$res_select_usereg = mysql_query($qry_select_usereg) or die(mysql_error());
if(mysql_num_rows($res_select_usereg)>0)
{
$_SESSION['ses_user_id'] = $_REQUEST['txtUserName'];
$_SESSION['ses_user_type'] = "0";//'0' for user
$_SESSION['ses_type'] = 'a';
unset($_REQUEST['txtUserName']);
unset($_REQUEST['txtPassword']);
unset($_REQUEST['action']);
header("Location: user_panel.php");
}
else
{
$err_msg_login = "- Username or password is incorrect or status is not active.";
}
}
else
{
$qry_select_usereg = "SELECT * FROM dealer_registration WHERE user_name = '".$_REQUEST['txtUserName']."' AND password = '".$_REQUEST['txtPassword']."' AND status = '1'";
$res_select_usereg = mysql_query($qry_select_usereg) or die(mysql_error());
if(mysql_num_rows($res_select_usereg)>0)
{
$_SESSION['ses_user_id'] = $_REQUEST['txtUserName'];
$_SESSION['ses_user_type'] = "1"; //'1' for trader
$_SESSION['ses_type'] = 'b';
unset($_REQUEST['txtUserName']);
unset($_REQUEST['txtPassword']);
unset($_REQUEST['action']);
header("Location: dealer_panel.php");
}
else
{
$err_msg_login = "- Username or password is incorrect or status is not active.";
}
}
}
else
{
$err_msg_login = "- Must select type user / trader.";
}
}
?>