h[k] = form[k].value cookie = Cookie.SimpleCookie() cookie_hash = mew.getCookieHash(os.environ) loggedInFlag = False if (("userId" in cookie_hash) and ("sessionId" in cookie_hash) and (mew.authenticateSession( cookie_hash["userId"], cookie_hash["sessionId"]) == 1)): loggedInFlag = True userId = None if "userId" in cookie_hash: userId = cookie_hash["userId"] msg, msgType = mew.processCookieMessage(cookie, cookie_hash) template = mew.slurp_file("template/search.html") nav = mew.slurp_file("template/navbar_template.html") footer = mew.slurp_file("template/footer_template.html") analytics = mew.slurp_file("template/analytics_template.html") userData = {} userId = None if loggedInFlag: userData = mew.getUser(cookie_hash["userId"]) userName = userData["userName"] userId = userData["id"] unamestr = "[" + str(userName) + "]"
import datetime import Cookie import meowaux as mew cgitb.enable() cookie = Cookie.SimpleCookie() cookie_hash = mew.getCookieHash(os.environ) if (("userId" not in cookie_hash) or ("sessionId" not in cookie_hash) or (mew.authenticateSession( cookie_hash["userId"], cookie_hash["sessionId"]) == 0)): print "Location:login" print sys.exit(0) message, messageType = mew.processCookieMessage(cookie, cookie_hash) userId = cookie_hash["userId"] userData = mew.getUser(userId) userName = userData["userName"] mew.log("cp") template = mew.slurp_file("template/usersettings.html") tmp_str = template.replace("<!--USER-->", userName) tmp_str = tmp_str.replace("<!--USERID-->", userId) tmp_str = tmp_str.replace("<!--LEFT-->", mew.slurp_file("template/left_template.html")) tmp_str = tmp_str.replace("<!--USERINDICATOR-->", mew.userIndicatorString(userId, userName))