note 50478 deleted from function.msql-num-rows by didou

From: Date: Mon, 04 Apr 2005 22:06:51 +0000
Subject: note 50478 deleted from function.msql-num-rows by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87458@lists.php.net to get a copy of this message
Note Submitter: powerchip88 at gmail dot com ---- 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 ?>

« previous php.notes (#87458) next »