Ejemplo n.º 1
0
def addrec():
    if request.method == 'POST':
        name_of_police_stn = request.form['name_of_police_stn']
        police_stn_no = request.form['police_stn_no']
        region1 = request.form['region1']
        address_ps = request.form['address_ps']
        ps_phone1 = request.form['ps_phone1']
        head_officer = request.form['head_officer']
        head_id = request.form['head_id']
        head_aadhar = request.form['head_aadhar']
        head_pan = request.form['head_pan']
        head_email = request.form['head_email']
        head_mob_no = request.form['head_mob_no']
        head_user_id1 = request.form['head_user_id1']
        head_pass1 = request.form['head_pass1']
        head_pass21 = request.form['head_pass21']
        pass_police = test(str(head_pass1))
        print(pass_police)
        #print (head_pan)
        app.db.insertUser(name_of_police_stn, police_stn_no, region1,
                          address_ps, ps_phone1, head_officer, head_id,
                          head_aadhar, head_pan, head_email, head_mob_no,
                          head_user_id1, pass_police, head_pass21)

        return render_template('home.html')
    else:
        return render_template('home.html')
Ejemplo n.º 2
0
def addrec1():
    if request.method == 'POST':
        name_of_comp = request.form['name_of_comp']
        reg_no = request.form['unique_reg_no']
        region = request.form['region']
        address_comp = request.form['address_comp']
        ps_phone = request.form['ps_phone']
        hr_name = request.form['hr_name']
        emp_id = request.form['emp_id']
        hr_aadhar = request.form['hr_aadhar']
        hr_pan = request.form['hr_pan']
        hr_email = request.form['hr_email']
        hr_mob_no = request.form['hr_mob_no']
        head_user_id = request.form['head_user_id']
        head_pass = request.form['head_pass']
        head_pass2 = request.form['head_pass2']
        pass_comp = test(str(head_pass))
        print(pass_comp)
        app.db.insertUser1(
            'INSERT INTO company_reg (name_of_comp, reg_no, region, address_comp,ps_phone, hr_name, emp_id, hr_aadhar, hr_pan, hr_email, hr_mob_no, head_user_id, head_pass, head_pass2) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
            name_of_comp, reg_no, region, address_comp, ps_phone, hr_name,
            emp_id, hr_aadhar, hr_pan, hr_email, hr_mob_no, head_user_id,
            pass_comp, head_pass2)
        #app.db.insertUser(name_of_comp, reg_no, region, address_comp, ps_phone, hr_name, emp_id, hr_aadhar, hr_pan, hr_email, hr_mob_no, head_user_id, head_pass, head_pass2)
        return render_template('home.html')
    else:
        return render_template('home.html')
Ejemplo n.º 3
0
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        demo = test(str(password))
        print(demo)
        print(password)
        #password.encode("ascii")
        #demo = [input(password).encode("ascii")]
        #print (demo)
        #for message in demo:
        #  result = md5_to_hex(md5(message))
        #print (password)
        #print (result)
        con = sqlite3.connect("database.db")
        con.row_factory = sqlite3.Row
        cur = con.cursor()
        cur.execute("SELECT * from login WHERE username=? AND password=?",
                    (username, demo))
        results = cur.fetchall()
        for row in results:
            type = row[2]
        if type == "admin":
            return admin_home()
        elif type == "police":
            return police_home()
        elif type == "company":
            return company_home()
    else:
        print("error")
        return render_template('home.html')
Ejemplo n.º 4
0
def login():

    if request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        demo = test(str(password))
        print(demo)
        print(password)
        error = None
        con = sqlite3.connect("database.db")
        con.row_factory = sqlite3.Row
        cur = con.cursor()
        cur.execute("SELECT * from login WHERE username=? AND password=?",
                    (username, demo))
        results = cur.fetchall()
        if results:
            for row in results:
                type = row[2]
            if type == "admin":
                return admin_home()
            elif type == "police":
                return police_home()
            elif type == "company":
                return company_home()
        #flash("Login Successfully!:")
        else:
            error = 'Incorrect Username or Password'
            return render_template('home.html', error=error)