[llvm-commits] CVS: llvm-www/releases/register.cgi
criswell at cs.uiuc.edu
Thu Dec 18 15:28:02 PST 2003
Changes in directory llvm-www/releases:
register.cgi updated: 1.12 -> 1.13
Attempt to accept only the email address if the user has already registered.
Diffs of the changes: (+60 -8)
diff -u llvm-www/releases/register.cgi:1.12 llvm-www/releases/register.cgi:1.13
--- llvm-www/releases/register.cgi:1.12 Thu Dec 18 15:01:03 2003
+++ llvm-www/releases/register.cgi Thu Dec 18 15:26:59 2003
@@ -75,6 +75,42 @@
+# Function: checkEmail()
+# This function searches through the database to see if the email address
+# has already been registered.
+#pickle.dump ((email, firstname, lastname, organization, title), logfile)
+def checkEmail (email):
+ # Assume we haven't found a matching entry.
+ foundentry = ('','','','','')
+ # Open the logfile read only.
+ logfile = file (logfilename, 'r')
+ found = 0
+ while (found == 0):
+ entry = pickle.load (logfile)
+ if (entry == email):
+ foundentry = entry
+ logfile.close ()
+ return foundentry
# Function: ValidateForm ()
@@ -91,14 +127,8 @@
organization = form.getfirst ('organization', '')
- # Verify that the name and email fields have been filled in.
+ # Verify the email address first.
- if (firstname == ''):
- return 'First name is empty.'
- if (lastname == ''):
- return 'Last name is empty.'
if (email == ''):
return 'Email address is empty.'
@@ -122,6 +152,23 @@
return 'Email address has no periods'
+ # Determine if the email address has been used in a previous
+ # registration.
+ entry = checkEmail (email)
+ if (entry != ''):
+ return 'registered'
+ # Verify that the name fields have been filled in.
+ if (firstname == ''):
+ return 'First name is empty.'
+ if (lastname == ''):
+ return 'Last name is empty.'
# Verify that there are no colons in fields placed in the logfile.
if (checkForColon (email)):
@@ -190,7 +237,7 @@
logfile = file (logfilename, 'a')
fcntl.lockf (logfile, fcntl.LOCK_EX)
- pickle.dump ((email, firstname, lastname, organization, title, plans), logfile)
+ pickle.dump ((email, firstname, lastname, organization, title), logfile)
fcntl.lockf (logfile, fcntl.LOCK_UN)
@@ -211,6 +258,11 @@
# Verify that everything in the form is correct.
error = ValidateForm (form)
+if (error == 'registered'):
+ print ('Location: /releases/download.html')
+ print ('')
+ sys.exit (0)
if (error != ''):
print ('Content-type: text/html')
print ('Status: 400 Bad Request')
More information about the llvm-commits