January 15, 2007

Support for bulk manual registrations

Filed under: NetReg (archived) — jason @ 12:11 pm

The school uses NetReg’s DHCP server to support lab machines as well as students and faculty. They want the lab machines to automatically be registered with NetReg so that users don’t have to register them with their own personal IDs. NetReg provides a manual registration function for one MAC address at a time, but that gets cumbersome for entering hundreds of lab machines. In addition, clearing all registrations will clear the manually registered machines, too.

I added functionality to admin.cgi to allow multiple user name/MAC address combinations to be entered at once. Under the covers, this new function calls the manual registration URL over and over for each entry. This way, all the checks and file locking that are already in place for the single manual registration will still be used.

Additionally, these bulk entries are saved into a separate file. I also provide new functions to load the registrations from this file into NetReg and to clear them out. So, you can clear all registrations without having to enter the bulk registrations all over again. After you clear all registrations, you simply reload all of your previous bulk registrations from the special file with the push of one button.

Now, for the scary part. I wrote all of this new functionality using PHP. I don’t know Perl very well (in fact I find the syntax mind numbing), so I had to do some trickery to integrate the PHP scripts with the existing Perl. Yes, I am a bad person. I’m sure that Martin Fowler has written a book about my kind and made millions from it. But, if you are not horrified, read on!

I made changes to add new forms and buttons for these functions to the “Manual Registration” page (seemed easier than dealing with the image map of links). Between the submit button and print_footer() call of reg_form() in admin.cgi, here’s what is new:
admin.cgi.txt

These new PHP files are installed in the same directory with admin.cgi:
netreg.php
bulkregstart.php
bulkreg.php
reloadbulk.php
clearbulk.php
viewbulk.php
clearregs.php

The functions to support clearing all registrations are also included in these changes.

• • •

No Comments »

No comments yet.

Comments RSSTrackBack URI

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image

Powered by WordPress |•| Wordpress Themes by priss