示例#1
0
def delete():
    UID = session.getUserFromSession()
    curs = session.cursor(session.connect())
    curs.execute('DELETE from user where UID=%s',(UID,))
    curs.execute('DELETE from userpass where id=%s',(UID,))
    curs.execute('DELETE from player where PID=%s',(UID,))
    curs.execute('DELETE from coach where CID=%s',(UID,))
    curs.execute('UPDATE team set manager=NULL where manager=%s',(UID,))
    
    line = "<div class='alert alert-danger'> Account deleted \t <a href='logout.cgi'>Return to Login</a> </div>"
    return line
示例#2
0
def submit(form_data):
#    print "submit method in createTeam.py"
    #connect to the database
    
    # Retrieve and escape the necessary data to insert into the database
    manager = session.getUserFromSession()
    name = cgi.escape(str(form_data.getfirst("teamName")))
    location = cgi.escape(str(form_data.getfirst("location"))) 

    if (name, location) != ("None", "None"):
        return createTeam(manager,name,location)
    else:
        return ""
示例#3
0
def submit(form_data,submit_type): 
    #need a different submit_type so that it executes the right code
    #print "submit method in createTeam.py"
    #connect to the database
        
    if (submit_type == "Update Attendance"):
        #retrieves the data from the form to update the database
        return updateAttendance(form_data)
        #execute Attendance thing
    elif (submit_type == "View Attendance"):
        return printAttendance(form_data) # Needs to retrieve the proper information in the data
    else:
    #retrieves the data from the form for the sql query for events
        view = form_data.getfirst("view") #whether in team or user mode
        TID = session.getTeamFromSession()
        UID = session.getUserFromSession()
    
    # print "view: " + view +", " + id #debugging ometimes doesn't work if id is empty
        return getEvent(str(TID),str(UID),view)
示例#4
0
def updatePass(password):
    curs = session.cursor(session.connect())
    UID = session.getUserFromSession()
    curs.execute('UPDATE userpass set password=password(%s) where id=%s',(password,UID))
    return "<div class='alert alert-success'>Pasword successfully updated!</div>"