DCOracle2 importing problems
Hugh
h.e.w.frater at cs.cf.ac.uk
Fri Apr 19 21:05:44 EDT 2002
I'm importing it in the interactive interpreter using:
>>> import cgi #runs fine
here's the cgi script:
import DCOracle2
import md5
import time
import base64
import cgi
import rotor
connectString = "'scm1hewf/carthage at cs2000'"
def makeSessionId(st):
string = ""
m = md5.new()
m.update('this is a test of the emergency broadcasting system')
m.update(str(time.time()))
m.update(str(st))
return string.replace(base64.encodestring(m.digest())[:-3], '/', '$')
def enc(password):
rt = rotor.newrotor('this is a test of the emergency broadcast system', 20)
return rt.encrypt(password)
def checkid(id, password):
db = DCOracle2.connect(connectString)
c = db.cursor()
query = "'select password from tblborrower where id = " + formid + "'"
c.execute(query)
return c.fetchone()
form = cgi.FieldStorage()
id = form.getvalue('id')
password = form.getvalue('password')
if (form.getvalue('id')):
encrytedpassword = enc(password)
sessionId = makeSessionId(id)
result = checkid(id, encryptedpassword)
More information about the Python-list
mailing list