6

PHP case-sensitive PHP login

 2 years ago
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

advertisements

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?

I am from Java background. In Java, every method has case-sensitive while calling. But in PHP, I didn't see the case-sensitive function name while calling the functions. class Sample { ... ... function sampleFunction() { .... .... } } $obj = new Samp

The PHP Case Sensitive Path Problem

I am running a SocialEngine PHP application, which i've recently migrated to another server. And from that point on - a problem occurs: The SocialEngine's core trying to include files in case insensitive paths, which appear not to exist (although, in

Are PHP functions case-sensitive?

I was digging through some code, and I found some calls to mySQL_fetch_array. Is PHP case sensitive about function names? I recall reading this somewhere but can't seem to find any reference to it.I am quoting from this: Note: Function names are case

Case sensitivity in PHP DateTime arguments

I'm creating DateTime objects using createFromFormat() method. I can't find it specified if the strings for format argument are case sensitive, where it comes to non-numerical parts. My question is about that matter - are the string arguments for Dat

PHP - How to compare two tables and remove duplicate values ​​Case Sensitive

I have 2 arrays of data that i want to compare and remove duplicates. I have a MasterArray and a CompareArray. I want to remove all Duplicates in MasterArray. I kind of have this working but its currently case sensitive, which I need to remove. This

php login script Undefined variable: script _session

i am trying to have a login script burt i have this error Undefined variable: _session see below the pages //checklogin.php <?php ob_start(); $host="localhost"; // Host name $username="xxxxx"; // Mysql username $password="xxxx&

PHP login script with Ajax loading Header on the same page

I have a PHP login script that I want to execute with ajax. The PHP script takes the user to a page if successful but according to the ajax request I am using, the header location also loads in the $('.logresult') div how do I do it such that it goes

PHP login, log in without user info

I'm working on a website and am having a problem with my PHP login script. The code lets people sign in through the login button without a username and password. Here's my code: <?php $indexPage = true; require_once 'libs/Config.php'; if (secureSessi

PHP login script - How many connections

I have a question from a potential client (hence, no code yet) about a website they have which has a custom login script. Basically, they have Analytics setup but it doesn't serve the purpose that they need - being able to tell how many times a user

Connecting my php login screen to my SQL DB

I don't really do much php myself but am in the process of creating a php login screen for a UI I am building to pull data to a table from a mysql db. I have the table connecting to the db fine and the general screen working but am having trouble wit

Nginx rewrite rules to match Apache Rewrite for php-login

Background: I was using this php application for my project https://github.com/panique/php-login/ When i started, i started with apache and completed my whole project. but when i have to push this to production server, they only support nginx. i trie

Bulk Password Hashing PHP-LOGIN PROJECT code

I have the following question / requirement. My website has 2000 users, however the passwords are stored using Plain text (I know this is super bad). From reading various website blogs, i found that i need to use modern password-hashing and salting.

PHP Login and Cookies work only on the start page

i am just learn php a week ago. but now i have a problem. my php login and session script, work in front page ONLY. when i tested with clear cookies, and type in browser to spesific page on my site (example: www.mysite.com/page34.html) THE LOGIN FORM

php login session in url friendly .html

i change my .php page to .html for url friendly Or page.php?id=10 to page/id/title using mod_rewrite and php. now i have Big problem, when i login in my panel if login page action = login.php login success and i see user panel but if login page actio

PHP-Login - Change code to check only the username and not the email

UPDATE: Sorry a lot of these comments are incorrect - the code is not susceptible to SQL Injection, I thought people would have checked it against PHP-Login.nets script. It is all escaped etc. I will link to the full script below. Also, the new SQL q

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK