forked from github/server
laufende änderungen
This commit is contained in:
parent
2a42b515b2
commit
fc39ac45e7
|
@ -70,20 +70,25 @@ if (password==None) or (custid==None):
|
||||||
else:
|
else:
|
||||||
db=MySQLdb.connect(db=dbname)
|
db=MySQLdb.connect(db=dbname)
|
||||||
cursor=db.cursor()
|
cursor=db.cursor()
|
||||||
exist=cursor.execute("select u.status, s.id, s.game from users u, subscriptions s where u.id="+custid+" and s.status in ('WAITING', 'CONFIRMED') and s.password='"+password+"'")
|
try:
|
||||||
|
custid=int(custid)
|
||||||
|
except:
|
||||||
|
custid=0
|
||||||
|
query = "select u.status, s.id, s.game from users u, subscriptions s where u.id="+str(custid)+" and s.status in ('WAITING', 'CONFIRMED') and u.status not in ('INVALID', 'BANNED') and s.password='"+password+"'"
|
||||||
|
exist=cursor.execute(query)
|
||||||
if exist==0:
|
if exist==0:
|
||||||
Display('<p>Kundennummer oder Schlüssel falsch. Bitte beachte, dass Du beim Schlüssel auf Groß- und Kleinschreibung achten mußt.')
|
Display('<p>Kundennummer oder Schlüssel falsch. Bitte beachte, dass Du beim Schlüssel auf Groß- und Kleinschreibung achten mußt.')
|
||||||
else:
|
else:
|
||||||
status, sid, gid = cursor.fetchone()
|
status, sid, gid = cursor.fetchone()
|
||||||
if os.environ.has_key('REMOTE_ADDR'):
|
if os.environ.has_key('REMOTE_ADDR'):
|
||||||
ip=os.environ['REMOTE_ADDR']
|
ip=os.environ['REMOTE_ADDR']
|
||||||
cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
|
cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(custid)+")")
|
||||||
if status=='NEW' or status=='TUTORIAL':
|
if status=='NEW' or status=='TUTORIAL':
|
||||||
if tutorial_id!=None and gid==tutorial_id:
|
if tutorial_id!=None and gid==tutorial_id:
|
||||||
# user confirms his tutorial participation
|
# user confirms his tutorial participation
|
||||||
cursor.execute("update users set status='TUTORIAL' where id="+custid)
|
cursor.execute("update users set status='TUTORIAL' where id="+str(custid))
|
||||||
else:
|
else:
|
||||||
cursor.execute("update users set status='ACTIVE' where id="+custid)
|
cursor.execute("update users set status='ACTIVE' where id="+str(custid))
|
||||||
cursor.execute("update subscriptions set status='CONFIRMED' where id="+str(sid))
|
cursor.execute("update subscriptions set status='CONFIRMED' where id="+str(sid))
|
||||||
|
|
||||||
Display("<p>Deine Anmeldung wurde bestätigt.");
|
Display("<p>Deine Anmeldung wurde bestätigt.");
|
||||||
|
|
|
@ -183,22 +183,26 @@ else:
|
||||||
if ip!=None:
|
if ip!=None:
|
||||||
cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
|
cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
|
||||||
|
|
||||||
# add a subscription record
|
|
||||||
password = genpasswd()
|
|
||||||
values="'WAITING', '"+password+"'"
|
|
||||||
fields="status, password"
|
|
||||||
game = game_id
|
game = game_id
|
||||||
if tutorial_id!=None and status!='ACTIVE':
|
if tutorial_id!=None and status!='ACTIVE':
|
||||||
game=tutorial_id
|
game=tutorial_id
|
||||||
if bonus!=None:
|
exist = cursor.execute("select id, password from subscriptions where status='WAITING' AND user="+str(custid)+" and game="+str(game))
|
||||||
fields=fields+", bonus"
|
if exist:
|
||||||
if bonus=='yes':
|
sid, password = cursor.fetchone()
|
||||||
values=values+", 1"
|
else:
|
||||||
else:
|
# add a subscription record
|
||||||
values=values+", 0"
|
password = genpasswd()
|
||||||
cursor.execute("insert into subscriptions (user, race, game, "+fields+") VALUES ("+str(int(custid))+", '"+race+"', "+str(game)+", "+values+")")
|
values="'WAITING', '"+password+"'"
|
||||||
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
fields="status, password"
|
||||||
sid = cursor.fetchone()[0]
|
if bonus!=None:
|
||||||
|
fields=fields+", bonus"
|
||||||
|
if bonus=='yes':
|
||||||
|
values=values+", 1"
|
||||||
|
else:
|
||||||
|
values=values+", 0"
|
||||||
|
cursor.execute("insert into subscriptions (user, race, game, "+fields+") VALUES ("+str(int(custid))+", '"+race+"', "+str(game)+", "+values+")")
|
||||||
|
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
||||||
|
sid = cursor.fetchone()[0]
|
||||||
Send(email, custid, sid, firstname, password, game)
|
Send(email, custid, sid, firstname, password, game)
|
||||||
text={"de":"Deine Anmeldung wurde bearbeitet. Eine EMail mit Hinweisen ist unterwegs zu Dir", "en":"Your application was processed. An email containing further instructions is being sent to you"}
|
text={"de":"Deine Anmeldung wurde bearbeitet. Eine EMail mit Hinweisen ist unterwegs zu Dir", "en":"Your application was processed. An email containing further instructions is being sent to you"}
|
||||||
Display("<p>"+text[locale]+".")
|
Display("<p>"+text[locale]+".")
|
||||||
|
|
|
@ -16,7 +16,7 @@ def genpasswd():
|
||||||
newpasswd = newpasswd + choice(chars)
|
newpasswd = newpasswd + choice(chars)
|
||||||
return newpasswd
|
return newpasswd
|
||||||
|
|
||||||
query = "select distinct u.email, s.id, s.password, r.name, u.locale, s.bonus from users u, races r, subscriptions s left join userips i on u.id=i.user left join bannedips b on i.ip=b.ip where s.user=u.id and b.ip is NULL and s.status='CONFIRMED' and r.race=s.race and s.game="+str(game_id)+" and r.locale='de' order by u.id"
|
query = "select distinct u.email, s.id, s.password, r.name, u.locale, s.bonus from users u, races r, subscriptions s left join userips i on u.id=i.user left join bannedips b on i.ip=b.ip where s.user=u.id and b.ip is NULL and s.status='CONFIRMED' and r.race=s.race and s.game="+str(game_id)+" and r.locale='de' order by s.id"
|
||||||
db=MySQLdb.connect(db=dbname)
|
db=MySQLdb.connect(db=dbname)
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
|
|
|
@ -47,6 +47,7 @@ def Send(email, custid, firstname, password, position, locale):
|
||||||
TemplateHandle.close() # close the file
|
TemplateHandle.close() # close the file
|
||||||
|
|
||||||
SubResult = re.subn("<FIRSTNAME>", firstname, TemplateInput)
|
SubResult = re.subn("<FIRSTNAME>", firstname, TemplateInput)
|
||||||
|
SubResult = re.subn("<GAME>", game, SubResult[0])
|
||||||
SubResult = re.subn("<PASSWORD>", password, SubResult[0])
|
SubResult = re.subn("<PASSWORD>", password, SubResult[0])
|
||||||
SubResult = re.subn("<POSITION>", str(int(position)), SubResult[0])
|
SubResult = re.subn("<POSITION>", str(int(position)), SubResult[0])
|
||||||
SubResult = re.subn("<CUSTID>", str(int(custid)), SubResult[0])
|
SubResult = re.subn("<CUSTID>", str(int(custid)), SubResult[0])
|
||||||
|
@ -70,7 +71,7 @@ cursor.execute("update subscriptions set status='EXPIRED' where TO_DAYS(updated)
|
||||||
cursor.execute("update subscriptions set status='WAITING' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='CONFIRMED'")
|
cursor.execute("update subscriptions set status='WAITING' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='CONFIRMED'")
|
||||||
|
|
||||||
# remind everyone who is left on the waiting list.
|
# remind everyone who is left on the waiting list.
|
||||||
waiting = cursor.execute("select firstname, locale, email, u.id, s.password, u.password from users u, subscriptions s where u.id=s.user and s.status='WAITING'")
|
waiting = cursor.execute("select firstname, locale, email, u.id, s.password, u.password from users u, subscriptions s where u.id=s.user and s.status='WAITING' ORDER BY s.id")
|
||||||
position=0
|
position=0
|
||||||
while waiting:
|
while waiting:
|
||||||
waiting=waiting-1
|
waiting=waiting-1
|
||||||
|
|
Loading…
Reference in New Issue