Re: Case sensitive password

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 19, 2008 at 4:18 PM, R.C. <rme@xxxxxxxxxxxxxxxxxxx> wrote:
> Andrew,
>
> That is correct.  Only ONE password to access a restricted page for selected
> people.  But... they want to make that ONE password case-insensitive.  I
> added the following code with 2 variables now, one being upper case, one
> being lower case but that, of course, doesn't cover all the variatons on the
> "video" word.  I'm looking for the code to make this whole word
> case-insensitive, no matter which letter is cap or not.... can you add to
> this code below please?
>
> session_start();
>
>  $_SESSION ['userpass'] = $_POST ['pass'];
>  $_SESSION ['authuser'] = 0;
>
> $login = "VIDEO";
> $login2 = "video";
>
> if (($_SESSION['userpass'] == $login) or ($_SESSION['userpass'] == $login2))
> {
> $_SESSION['authuser'] = 1;
> ?>

    Try this:

<?php

if(preg_match('/^'.$_SESSION['userpass'].'$/i',$login)) {
        echo "Good.\n";
} else {
        echo "Bad.\n";
}

?>


-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux