def GET(self): user_data = web.input() phone_num = user_data['phone_num'] name = user_data['name'] choices = eval(user_data['choices']) # web.header('content-type', 'json') # return json.dumps({'correct_num': name, 'error':'yes'}) flag = True count = 0 for k, v in choices.iteritems(): try: if db.check(k, v): count += 1 except: flag = False break if flag: if db.record(name, phone_num, count): web.header('content-type', 'json') return json.dumps({'correct_num': count, 'error': 'no'}) else: web.header('content-type', 'json') return json.dumps({'correct_num': 0, 'error': 'yes'}) else: web.header('content-type', 'json') return json.dumps({'correct_num': 0, 'error': 'yes'})
def add(update: Update, context: CallbackContext): users = [] user = update.effective_user id = user['id'] msg = "" #check if already in users.txt users = db.check(user.mention_markdown(), update.effective_chat.id) if len(users) != 0: msg = "You've already been added!" context.bot.send_message( chat_id=update.effective_chat.id, text=msg, reply_to_message_id=update.effective_message.message_id, parse_mode="Markdown", ) return db.insert(user.mention_markdown(), update.effective_chat.id) msg = "You've been added! Please start me personally to get notified @invisibletagbot." context.bot.send_message( chat_id=update.effective_chat.id, text=msg, reply_to_message_id=update.effective_message.message_id, parse_mode="Markdown", )
def checkDate(): osis = int(request.args["ID"]) registered = db.check(osis) if len(registered) == 0: return render_template("checker.html", all = registered, error = "Unfortunately, you", bold = " (OSIS: " + str(osis) + ") ", notbold = "have not signed up for a prom date yet") else: return render_template("checker.html", all = registered, id = osis)
def post(self): username = self.get_argument('username','') password = self.get_argument('password','') if db.check(username,password): self.set_secure_cookie("WLBLOG",username) self.write("1") else: self.write("0")
def post(self): user = self.get_secure_cookie("WLBLOG") username=self.get_argument('newuser','') oldpwd=self.get_argument('oldpwd','') pwd1=self.get_argument('pwd1','') if db.check(user,oldpwd): if not username: username=user db.db("UPDATE Ver SET PASSWORD='******',USERNAME='******' WHERE USERNAME='******'" % (pwd1,username,user)) self.write("0") else: self.write("密码修改失败,请确认你的输入!")
def checkCardWithDatabase(database, h_ash): print ("Checking card...") db.check(database, h_ash)
def login(username, password): if(db.check(username, password)): return True else: return False
def check(): # It is for seeing all of available usernames. db.check()
def db_check(): return db.check(db)