diff --git a/scripts/cgi-bin/eressea-confirm.py b/scripts/cgi-bin/eressea-confirm.py index 8f55c133c..1fd80a123 100755 --- a/scripts/cgi-bin/eressea-confirm.py +++ b/scripts/cgi-bin/eressea-confirm.py @@ -3,6 +3,7 @@ import sys import MySQLdb import cgi +import os import re # specify the filename of the template file @@ -67,6 +68,9 @@ else: if exist==0: Display('
Kundennummer oder Schlüssel falsch. Bitte beachte, dass Du beim Schlüssel auf Groß- und Kleinschreibung achten mußt.') else: + if os.environ.has_key('REMOTE_ADDR'): + ip=os.environ['REMOTE_ADDR'] + cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")") cursor.execute("update users set status='CONFIRMED' where password='"+password+"' and id="+custid) Display("
Deine Anmeldung wurde bestätigt.");
db.close()
diff --git a/scripts/cgi-bin/eressea-register.py b/scripts/cgi-bin/eressea-register.py
index a599c8bec..bc3860352 100755
--- a/scripts/cgi-bin/eressea-register.py
+++ b/scripts/cgi-bin/eressea-register.py
@@ -2,6 +2,7 @@
import sys
import MySQLdb
+import os
import cgi
import re
import string
@@ -15,6 +16,7 @@ MailTemplate="register.mail"
DefaultTitle = "Eressea Anmeldung"
dbname = "eressea"
From = "accounts@eressea-pbem.de"
+locale="de"
smtpserver = 'localhost'
db=None
@@ -41,7 +43,7 @@ def Display(Content, Title=DefaultTitle):
def Send(email, custid, firstname, password, position):
- TemplateHandle = open(MailTemplate, "r") # open in read only mode
+ TemplateHandle = open(MailTemplate+"."+locale, "r") # open in read only mode
# read the entire file as a string
TemplateInput = TemplateHandle.read()
TemplateHandle.close() # close the file
@@ -51,7 +53,7 @@ def Send(email, custid, firstname, password, position):
SubResult = re.subn(" Um Dich zu Eressea anzumelden musst Du das Formular vollständig ausfüllen.\n "
for key in Form.keys():
- output=output+" Um Dich zu Eressea anzumelden musst Du eine gültige Email-Adresse angeben.\n "
Display(output)
else:
db=MySQLdb.connect(db=dbname)
@@ -100,8 +115,8 @@ else:
Display(' Du stehst bereits auf der Warteliste')
else:
password=genpasswd()
- fields = "firstname, lastname, email, address, city, status, password"
- values = "'"+firstname+"', '"+lastname+"', '"+email+"', '"+address+"', '"+city+"', 'WAITING', '"+password+"'"
+ fields = "firstname, lastname, locale, email, address, city, status, password"
+ values = "'"+firstname+"', '"+lastname+"', '"+locale+"', '"+email+"', '"+address+"', '"+city+"', 'WAITING', '"+password+"'"
if phone!=None:
fields=fields+", phone"
values=values+", '"+phone+"'"
@@ -111,9 +126,21 @@ else:
if country!=None:
fields=fields+", country"
values=values+", "+country+""
+ if referrer!=None:
+ fields=fields+", referrer"
+ values=values+", '"+referrer+"'"
+ if firsttime!=None:
+ fields=fields+", firsttime"
+ if firsttime=='yes':
+ values=values+", 1"
+ else:
+ values=values+", 0"
cursor.execute("insert into users ("+fields+") VALUES ("+values+")")
cursor.execute("SELECT LAST_INSERT_ID() from dual")
custid=cursor.fetchone()[0]
+ if os.environ.has_key('REMOTE_ADDR'):
+ ip=os.environ['REMOTE_ADDR']
+ cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
cursor.execute("insert into subscriptions (user, race, game, status) VALUES ("+str(int(custid))+", '"+race+"', 0, 'PENDING')")
cursor.execute("select count(*) from users")
Send(email, custid, firstname, password, cursor.fetchone()[0])
diff --git a/scripts/cgi-bin/register.mail b/scripts/cgi-bin/register.mail.de
similarity index 100%
rename from scripts/cgi-bin/register.mail
rename to scripts/cgi-bin/register.mail.de
diff --git a/scripts/cgi-bin/register.mail.en b/scripts/cgi-bin/register.mail.en
new file mode 100644
index 000000000..77e6a0b82
--- /dev/null
+++ b/scripts/cgi-bin/register.mail.en
@@ -0,0 +1,20 @@
+Hello
"+str(key)+"="+str(Form[key])
+ output=output+"
"+key+": "+Form[key].value+"\n"
+ Display(output)
+elif ValidEmail(email)==0:
+ output="