php_begins Posted March 4, 2011 Share Posted March 4, 2011 Hi, currently in my registration code, the userId allows only six digits as the user ID. I need help in performing the following task 1. Modify the account creation screen to allow users to enter EITHER a 6-digit ID OR a 9 character ID. Any 6-digit PLID will be stored with the perpended B11. 2.Modify the login utility for the users to allow them to use either the 6-digit or 9-character IDs which means you will need to prepend the B11 to any 6-digit PLID to find their record in the database. 3.Convert existing PLIDs in the database to the new format by prepending the B11. Any coding help will be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted March 4, 2011 Share Posted March 4, 2011 And where are you stuck, exactly? Quote Link to comment Share on other sites More sharing options...
php_begins Posted March 21, 2011 Author Share Posted March 21, 2011 function checkuser($id) { $id = mysql_real_escape_string($id); $query = "SELECT * FROM $tbl_employment_users WHERE id='$id'"; $rowcount = mysql_num_rows(mysql_db_query($db_name, $query)); if ($rowcount == 0) return false; else return true; } function validateuser($id, $userpassword) { $id = mysql_real_escape_string($id); $userpassword = mysql_real_escape_string($userpassword); $query = "SELECT * from $tbl_employment_users where id='$id' and userpassword='$userpassword'"; $rowcount = mysql_num_rows(mysql_db_query($db_name, $query)); if( $rowcount > 0 ) { return true; } else { return false; } } The above function validates usernames and password. I have appended all the existing 6 digit usernames in the database with B11 (for eg: B11600123) I need to write a code such that if a user logins with the username 600123, it should check with B11600123 in the database and let him/her login. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.