note 27443 added to function.strcasecmp

From: Date: Fri, 06 Dec 2002 01:43:12 +0000
Subject: note 27443 added to function.strcasecmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-40399@lists.php.net to get a copy of this message
Just a note ---------------------------------- The returns on the function aren't like most returns, kinda strage. Here's my example on a non case sensative password test <? /* Normally by looking at the code below it will seem that it should return 1 or true but since it functions a little different, 0 is good and 1 is bad :-\ .... So anyways, heres the following code on some cheesy password example assuming the password came from a form */ // Check if password matches, if it doesnt send to error page if(strcasecmp("password", $_POST['password'])){ header("Location: error.php?e=bad_password"); exit(); } ?> Hope this helps someone -- http://www.php.net/manual/en/function.strcasecmp.php http://master.php.net/manage/user-notes.php?action=edit+27443 http://master.php.net/manage/user-notes.php?action=delete+27443 http://master.php.net/manage/user-notes.php?action=reject+27443

« previous php.notes (#40399) next »