Atlast I upgrade the regcode module for Drupal 5.1
The code is here
1. For regcode.info
==================
; $Id: regcode.info,v 1.1 2007/01/03 01:29:15 drewish Exp $
name = Regcode Example
description = An example demonstrating how a registration code appear in user registration form.
package = Regcode
2. For regcode.module
=================
<?php
// $Id: regcode.module,v 1.1 2007/02/22 20:10:18 colan Exp $
/**
* @file
* regcode.module
*/
// Initial written by nevets (http://drupal.org/user/12856).
// See http://drupal.org/node/85861 for details.
// Edited and hacked on by colan (http://drupal.org/user/58704).
/**
* Display help and module information.
*
* @param section
* which section of the site we're displaying help
* @return
* help text for section
*/
function regcode_help($section) {
switch ($section) {
case 'admin/help#regcode':
return t('
Allows administrators to set a registration code or codes
that new users must enter before they can complete the registration
process. If a new user enters a code that is not in the list of
valid codes, he or she is denied registration.
To set the codes, go to Administer->Site Configuration->Regcode and enter
them there. To disable the registration code requirement for new
users, simply disable the module (in administer->modules).
');
case 'admin/modules#description':