note 50478 added to function.msql-num-rows

From: Date: Tue, 01 Mar 2005 17:27:14 +0000
Subject: note 50478 added to function.msql-num-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-85736@lists.php.net to get a copy of this message
One eks. (lite of a login script) <? /** * Checks whether or not the given username is in the * database, if so it checks if the given password is * the same password in the database for that user. * If the user doesn't exist or if the passwords don't * match up, it returns an error code (1 or 2). * On success it returns 0. */ function confirmUser($username, $password){ global $conn; /* Add slashes if necessary (for query) */ if(!get_magic_quotes_gpc()) { $username = addslashes($username); } /* Verify that user is in database */ $q = "select password from users where username = '$username'"; $result = mysql_query($q,$conn); if(!$result || (mysql_numrows($result) < 1)){ return 1; //Indicates username failure ?> ---- Manual Page -- http://www.php.net/manual/en/function.msql-num-rows.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50478 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50478&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50478&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50478&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50478&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50478&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50478&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85736) next »