Results 1 to 3 of 3

Thread: member system Validation code

  1. #1
    Join Date
    Jun 2005

    member system Validation code

    How do they generate those Validation codes.

    The ones that they use when you register for a forum or something. You register and you have to go to a page and enter a specific validation code to activate your account, or you click a link in the email and it activates your account.

    How does that system work? (Note: I am not talking about Captcha)

    Thanks in advance,
    ~Heavy Metal

  2. #2
    Join Date
    Jan 2005
    That's quite easy.

    When you register there are 2 additional fields.

    First field will indicate if an account is activated or not (also lets you block accounts ect) This can be done by 0=not activated 1=live ect

    Second field is a random code for activation. This can also be used for resetting the password. The code is generated during registration inserted into the database.

    When you enter the code or click on the link in the email, the system looks for the code in the database and simply changes the first field to 1 and deletes the code from the database.

  3. #3
    Join Date
    Jun 2005
    Okay, so how is that random code generated? Is it via PHP or what?

    ~Heavy Metal

    EDIT: I found this nice little code on the internet and altered it a bit. It does a decent job of generating random strings.

    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $i = 0;
    $pass = '';
    while ($i <= 13) {
      $num = rand() % 33;
      $tmp = substr($chars, $num, 1);
      $pass = $pass . $tmp;
    echo $pass;
    Is everything in this code done the right way? Is there a better way to generate random strings?
    ~Heavy Metal
    Last edited by Heavy Metal; 07-23-2008 at 01:33 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles