Esempio n. 1
0
    def get(self):
        conn = pymysql.connect(host='localhost', port=3306, user='******', passwd='root', db='selenium', charset='utf8')
        cur = conn.cursor()
        cur.execute("SELECT * FROM userinfo")
        rows = dictfetchall(cur)
        for row in rows:
            sex = row["sex"]
            self.write(sex)
            s = sex.encode('UTF-8')
            print(s)


        cur.close()
        conn.close()
        self.write('Hello World!')
Esempio n. 2
0
    def post(self):
        username = self.get_argument('username')
        password = self.get_argument('password')
        print(username + ': ' + password)

        conn = sqlite3.connect('data.sqlite')
        cursor = conn.cursor()

        sql = '''
        select * from users
        where username = "******" and password="******"
        ''' % (username, password)

        cursor.execute(sql)
        r = dictfetchall(cursor)
        if r == []:
            self.write({'success': False})
        else:
            self.set_cookie('user', username)
            self.write({'success': True})
Esempio n. 3
0
    def post(self):
        username = self.get_argument('username')
        password = self.get_argument('password')
        print(username + ': ' + password)

        conn = sqlite3.connect('data.sqlite')
        cursor = conn.cursor()

        sql = '''
        select * from users
        where username = "******" and password="******"
        ''' % (username, password)

        cursor.execute(sql)
        r = dictfetchall(cursor)
        if r == []:
            self.write({'success': False})
        else:
            self.set_cookie('user', username)
            self.write({'success': True})