Jump to content

php login and register append characters


php_begins

Recommended Posts

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.

 

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.