forked from github/server
scriptänderungen
This commit is contained in:
parent
54b84bf78d
commit
4b1bc8f73d
|
@ -54,6 +54,16 @@ matchemail=re.compile(
|
||||||
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
||||||
email=None
|
email=None
|
||||||
|
|
||||||
|
matchuserid=re.compile(
|
||||||
|
r""".*userid:\s*([^\n\r]*)\s*""",
|
||||||
|
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
||||||
|
userid=None
|
||||||
|
|
||||||
|
matchpassword=re.compile(
|
||||||
|
r""".*passwort:\s*([^\n\r]*)\s*""",
|
||||||
|
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
||||||
|
password=None
|
||||||
|
|
||||||
matchaddress=re.compile(
|
matchaddress=re.compile(
|
||||||
r""".*adresse:\s*([^\n\r]*)\s*""",
|
r""".*adresse:\s*([^\n\r]*)\s*""",
|
||||||
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
||||||
|
@ -90,7 +100,7 @@ matchstandin=re.compile(
|
||||||
standin=0
|
standin=0
|
||||||
|
|
||||||
matchwaiting=re.compile(
|
matchwaiting=re.compile(
|
||||||
r""".*Warteliste: on\s(on)\s*""",
|
r""".*Warteliste:\s(on)\s*""",
|
||||||
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
re.IGNORECASE | re.DOTALL | re.VERBOSE)
|
||||||
waiting=0
|
waiting=0
|
||||||
|
|
||||||
|
@ -117,6 +127,15 @@ for line in sys.stdin.readlines():
|
||||||
email=match.group(1)
|
email=match.group(1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
match=matchuserid.match(line)
|
||||||
|
if (match!=None):
|
||||||
|
userid=match.group(1)
|
||||||
|
continue
|
||||||
|
match=matchpassword.match(line)
|
||||||
|
if (match!=None):
|
||||||
|
password=match.group(1)
|
||||||
|
continue
|
||||||
|
|
||||||
match=matchfirstname.match(line)
|
match=matchfirstname.match(line)
|
||||||
if (match!=None):
|
if (match!=None):
|
||||||
firstname=match.group(1)
|
firstname=match.group(1)
|
||||||
|
@ -149,46 +168,60 @@ for line in sys.stdin.readlines():
|
||||||
oldrace=validrace(oldrace)
|
oldrace=validrace(oldrace)
|
||||||
newrace=validrace(newrace)
|
newrace=validrace(newrace)
|
||||||
|
|
||||||
if (email==None):
|
okay=0
|
||||||
error("enno@eressea.upb.de",
|
if (password!=None) & (userid!=None):
|
||||||
"Es wurde keine Emailadresse angegeben: "+firstname+" "+lastname)
|
query="select id from users where password='" + password + "' and id="+str(userid)
|
||||||
elif (oldrace==None) & (newrace==None) & (standin==0) & (waiting==0):
|
|
||||||
error(email, "Es wurde kein Spiel ausgewählt.")
|
|
||||||
elif (firstname==None):
|
|
||||||
error(email, "Es wurde kein Vorname angegeben")
|
|
||||||
elif (lastname==None):
|
|
||||||
error(email, "Es wurde kein Nachname angegeben")
|
|
||||||
elif (address==None):
|
|
||||||
error(email, "Es wurde keine Adresse angegeben")
|
|
||||||
elif (city==None):
|
|
||||||
error(email, "Es wurde kein Wohnort angegeben")
|
|
||||||
elif (country==None):
|
|
||||||
error(email, "Es wurde kein Land angegeben")
|
|
||||||
else:
|
|
||||||
if (phone==None):
|
|
||||||
phone = "NULL"
|
|
||||||
|
|
||||||
cursor=db.cursor()
|
cursor=db.cursor()
|
||||||
cursor.execute("INSERT INTO users (firstname, lastname, email, address, city, phone, country, password) "+
|
num=cursor.execute(query)
|
||||||
"VALUES ('"+firstname+"', '"+lastname+"', '"+email+"', '"+address+"', '"+city+"', '"+phone+"', "+country+", '"+genpasswd()+"')")
|
if num==1:
|
||||||
|
okay=1
|
||||||
|
else:
|
||||||
|
if email==None:
|
||||||
|
email="enno@eressea.upb.de"
|
||||||
|
error(email, "Das Passwort für Kundennummer "+str(userid)+" war nicht korrekt.")
|
||||||
|
|
||||||
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
else:
|
||||||
lastid=str(int(cursor.fetchone()[0]))
|
if email==None:
|
||||||
|
error("enno@eressea.upb.de",
|
||||||
|
"Es wurde keine Emailadresse angegeben: "+firstname+" "+lastname)
|
||||||
|
elif (oldrace==None) & (newrace==None) & (standin==0) & (waiting==0):
|
||||||
|
error(email, "Es wurde kein Spiel ausgewählt.")
|
||||||
|
elif (firstname==None):
|
||||||
|
error(email, "Es wurde kein Vorname angegeben")
|
||||||
|
elif (lastname==None):
|
||||||
|
error(email, "Es wurde kein Nachname angegeben")
|
||||||
|
elif (address==None):
|
||||||
|
error(email, "Es wurde keine Adresse angegeben")
|
||||||
|
elif (city==None):
|
||||||
|
error(email, "Es wurde kein Wohnort angegeben")
|
||||||
|
elif (country==None):
|
||||||
|
error(email, "Es wurde kein Land angegeben")
|
||||||
|
else:
|
||||||
|
if (phone==None):
|
||||||
|
phone = "NULL"
|
||||||
|
okay=1
|
||||||
|
cursor=db.cursor()
|
||||||
|
cursor.execute("INSERT INTO users (firstname, lastname, email, address, city, phone, country, password) "+
|
||||||
|
"VALUES ('"+firstname+"', '"+lastname+"', '"+email+"', '"+address+"', '"+city+"', '"+phone+"', "+country+", '"+genpasswd()+"')")
|
||||||
|
|
||||||
|
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
||||||
|
userid=str(int(cursor.fetchone()[0]))
|
||||||
|
|
||||||
|
if okay:
|
||||||
if (oldrace!=None):
|
if (oldrace!=None):
|
||||||
error(email, "Derzeit wird kein Spiel nach alten Regeln angeboten")
|
error(email, "Derzeit wird kein Spiel nach alten Regeln angeboten")
|
||||||
# cursor.execute("INSERT INTO subscriptions (user, race, game) "+
|
# cursor.execute("INSERT INTO subscriptions (user, race, game) "+
|
||||||
# "VALUES ("+lastid+", '"+oldrace+"', 1)")
|
# "VALUES ("+str(userid)+", '"+oldrace+"', 1)")
|
||||||
if (newrace!=None):
|
if (newrace!=None):
|
||||||
error(email, "Derzeit wird kein Spiel nach neuen Regeln angeboten")
|
error(email, "Derzeit wird kein Spiel nach neuen Regeln angeboten")
|
||||||
# cursor.execute("INSERT INTO subscriptions (user, race, game, status) "+
|
# cursor.execute("INSERT INTO subscriptions (user, race, game, status) "+
|
||||||
# "VALUES ("+lastid+", '"+newrace+"', 2, 'WAITING')")
|
# "VALUES ("+str(userid)+", '"+newrace+"', 2, 'WAITING')")
|
||||||
if waiting:
|
if waiting:
|
||||||
cursor.execute("INSERT INTO subscriptions (user, game, status) "+
|
cursor.execute("INSERT INTO subscriptions (user, game, status) "+
|
||||||
"VALUES ("+lastid+", 3, 'WAITING')")
|
"VALUES ("+str(userid)+", 3, 'WAITING')")
|
||||||
if standin:
|
if standin:
|
||||||
cursor.execute("INSERT INTO subscriptions (user, game, status) "+
|
cursor.execute("INSERT INTO subscriptions (user, game, status) "+
|
||||||
"VALUES ("+lastid+", 4, 'WAITING')")
|
"VALUES ("+str(userid)+", 4, 'WAITING')")
|
||||||
|
|
||||||
errors.close()
|
errors.close()
|
||||||
unlock(sys.argv[1]+".err")
|
unlock(sys.argv[1]+".err")
|
||||||
|
|
|
@ -5,9 +5,9 @@ select u.id ID, left(concat(firstname,' ',lastname, ' <',email,'>'),43) Name, su
|
||||||
GROUP BY u.id
|
GROUP BY u.id
|
||||||
HAVING SUM(t.balance)<2.5;
|
HAVING SUM(t.balance)<2.5;
|
||||||
|
|
||||||
select count(users.status) Anzahl, users.status Status, games.name Spiel
|
select count(users.status) Anzahl, subscriptions.status Status, games.name Spiel
|
||||||
from users, games, subscriptions
|
from users, games, subscriptions
|
||||||
where games.id = subscriptions.game
|
where games.id = subscriptions.game
|
||||||
and users.id = subscriptions.user
|
and users.id = subscriptions.user
|
||||||
group by games.name, users.status
|
group by games.name, subscriptions.status
|
||||||
order by subscriptions.game;
|
order by subscriptions.game;
|
||||||
|
|
Loading…
Reference in New Issue