Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 26th, 2007, 04:49 AM
Registered User
Join Date: Dec 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default login php Case Problem

I have a php login page that match the user name and password from a table in mysql table.

user name and password values are in small caps in database table.

But when I try to login with uppercase (capital letters) it aslo allow me to login.

I want to make my login page case sensitive. what should I do ??

Old February 26th, 2007, 09:48 AM
Registered User
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

if you post the bit where you do the checking , someone might be able to help you.

Old March 5th, 2007, 08:05 AM
Authorized User
Join Date: Mar 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to malay mehta Send a message via Yahoo to malay mehta

Hi, if you are only using lower case then it should not be a problem for you. Prepare a function and then just allow only the ASCII values or the alphabets in the lower case only.This would solve your problem.....


malay mehta
Old March 7th, 2007, 12:58 AM
Registered User
Join Date: Dec 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

hi I have the following code........I have tried but failed to make login case sensitive.....( I do not want to use only lower case..I want to make login case sensitive)

$errorMessage = '';
if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {

    $userId = $_POST['txtUserId'];

    $password = ($_POST['txtPassword']);
     require_once("db_fns.php");//mysql db and username info file

    $sql = "SELECT *
            FROM adminuser
            WHERE username = '$userId' AND password = '$password'";

    $result = mysql_query($sql) or die('Query failed. ' . mysql_error());

   // print $admin;
    if (mysql_num_rows($result) == 1) {

           $_SESSION['db_is_logged_in'] = true;


        header('Location: main.php');
    } else {
        $errorMessage = 'Sorry, wrong user id / password';



But this make login without case sensitivity



Similar Threads
Thread Thread Starter Forum Replies Last Post
making login case sensitive with mysql database crmpicco MySQL 0 August 18th, 2006 05:48 AM
PHP Login script problem columbo1977 Beginning PHP 1 May 21st, 2006 10:47 PM
Php login session problem programmer Beginning PHP 1 August 3rd, 2004 03:57 AM
search string either Upper case or lower case rylemer Beginning VB 6 3 March 24th, 2004 04:23 PM
Check Case in a Case-Insensitive DB nbryson SQL Language 1 January 23rd, 2004 07:36 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.