![](/style/images/good.png)
![](/style/images/bad.png)
PHP case-sensitive PHP login
source link: https://www.codesd.com/item/php-case-sensitive-php-login.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
PHP case-sensitive PHP login
I am learning out to do website log-in and create creation. I am facing the probably where my script does not check if the two strings are the same case. Example, Foo and foO return both true.
My current PHP script is:
//Create query
$qry="SELECT * FROM member WHERE username='$username' AND password='$password'";
$result=mysql_query($qry);
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) > 0) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['mem_id'];
$_SESSION['SESS_FIRST_NAME'] = $member['username'];
$_SESSION['SESS_LAST_NAME'] = $member['password'];
session_write_close();
you can use "COLLATE latin1_general_cs" character set to differentiate to upper case or lower case.
SELECT * FROM `table` WHERE `your condiction` COLLATE latin1_general_cs;
or you can use
SELECT * FROM `table` WHERE BINARY `column` = 'value'
Related Articles
Are PHP function names case-sensitive or not?
The PHP Case Sensitive Path Problem
Are PHP functions case-sensitive?
Case sensitivity in PHP DateTime arguments
PHP - How to compare two tables and remove duplicate values Case Sensitive
php login script Undefined variable: script _session
PHP login script with Ajax loading Header on the same page
PHP login, log in without user info
PHP login script - How many connections
Connecting my php login screen to my SQL DB
Nginx rewrite rules to match Apache Rewrite for php-login
Bulk Password Hashing PHP-LOGIN PROJECT code
PHP Login and Cookies work only on the start page
php login session in url friendly .html
PHP-Login - Change code to check only the username and not the email
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK