[llvm-commits] CVS: llvm-www/releases/testregister.cgi

John Criswell criswell at cs.uiuc.edu
Thu Dec 18 15:19:01 PST 2003


Changes in directory llvm-www/releases:

testregister.cgi updated: 1.20 -> 1.21

---
Log message:

Attempt at implementing skipping the registration process.



---
Diffs of the changes:  (+59 -7)

Index: llvm-www/releases/testregister.cgi
diff -u llvm-www/releases/testregister.cgi:1.20 llvm-www/releases/testregister.cgi:1.21
--- llvm-www/releases/testregister.cgi:1.20	Thu Dec 18 14:58:08 2003
+++ llvm-www/releases/testregister.cgi	Thu Dec 18 15:18:19 2003
@@ -76,6 +76,42 @@
 	return
 
 #
+# Function: checkEmail()
+#
+# Description:
+#	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 = ('','','','','')
+	try:
+		#
+		# Open the logfile read only.
+		#
+		logfile = file (logfilename, 'r')
+
+		found = 0
+		while (found == 0):
+			entry = pickle.load (logfile)
+			if (entry[0] == email):
+				entry = foundentry
+				break
+	except:
+		pass
+
+	try:
+		logfile.close ()
+	except:
+		pass
+
+	return foundentry
+
+#
 # Function: ValidateForm ()
 #
 # Description:
@@ -92,14 +128,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.'
 
@@ -123,6 +153,23 @@
 		return 'Email address has no periods'
 
 	#
+	# Determine if the email address has been used in a previous
+	# registration.
+	#
+	entry = checkEmail (email)
+	if (entry[0] == email):
+		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)):
@@ -212,6 +259,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 mailing list