示例#1
0
                tempList.append(tempChar)
            tempPos = 0

            while len(tempList) > 0:
                tempNum += int(l.pop()) * (10**counter)
                counter += 1
            counter = 1

            values.append(tempNum)
            keys.append(dictTemp[x])
    keyOut.extend(keys)
    valOut.extend(values)


################### PAGE START ###################
print htmlFuncts.startPageN("Pair")
print "Stanley Lin and Gordon Lei"
print "<a href='http://149.89.161.100/~gordon.lei/labs/lab14/lab14.py'>Gordon's version</a>"

form = cgi.FieldStorage()

### The form
print """<form method='GET' action='lab14.py'>
Choose a book: <select name="qBook" size="1">
<option>othello</option>
<option>hamlet</option>
<option>dante</option>
<option>macbeth</option>
</select>
<br>
Choose another book: <select name="qBook2" size="1">
示例#2
0
#!/usr/bin/python
print "content-type: text/html\n"
import sys
import cgitb
import cgi
sys.path.insert(0, "../modules")
import htmlFuncts
import loginFuncts

cgitb.enable()

form = cgi.FieldStorage()

print htmlFuncts.startPageN("Login")

print """
<form method="GET" action="login.py">
	Username: <input name="username" type="textfield">
	<br>
	Password: <input name="pass" type="password">
	<br>
	<input name="done" type="submit" value="yay">
</form>
"""

if "done" in form:
	direct = "data/"
	data = "users.txt"
	logFile = "loggedIn.txt"
	
	idKey = loginFuncts.login(
#!/usr/bin/python
print "content-type: text/html\n"
import sys
import cgitb
import cgi
sys.path.insert(0, "../modules")
import htmlFuncts
import loginFuncts
import os

cgitb.enable()

form = cgi.FieldStorage()

print htmlFuncts.startPageN("Main")

direct = "data/"
logFile = "loggedIn.txt"
dataList = loginFuncts.getFileData(direct, logFile)
ip = os.environ["REMOTE_ADDR"]

for x in dataList:
    if form.getvalue("user") == x[0] and \
     form.getvalue("id") == x[1] and \
     ip == x[2]:
        print "logged in"
    else:
        print "<a href='login.py'>Go log in</a>"

print htmlFuncts.endPage()
示例#4
0
                tempList.append(tempChar)
            tempPos = 0

            while len(tempList) > 0:
                tempNum += int(l.pop()) * (10 ** counter)
                counter += 1
            counter = 1

            values.append(tempNum)
            keys.append(dictTemp[x])
    keyOut.extend(keys)
    valOut.extend(values)


################### PAGE START ###################
print htmlFuncts.startPageN("Pair")
print "Stanley Lin and Gordon Lei"
print "<a href='http://149.89.161.100/~gordon.lei/labs/lab14/lab14.py'>Gordon's version</a>"

form = cgi.FieldStorage()


### The form
print """<form method='GET' action='lab14.py'>
Choose a book: <select name="qBook" size="1">
<option>othello</option>
<option>hamlet</option>
<option>dante</option>
<option>macbeth</option>
</select>
<br>
示例#5
0
#!/usr/bin/python
print "content-type: text/html\n"
import sys
import cgitb
import cgi

sys.path.insert(0, "../modules")
import htmlFuncts
import loginFuncts

cgitb.enable()

form = cgi.FieldStorage()

print htmlFuncts.startPageN("Login")

print """
<form method="GET" action="login.py">
	Username: <input name="username" type="textfield">
	<br>
	Password: <input name="pass" type="password">
	<br>
	<input name="done" type="submit" value="yay">
</form>
"""

if "done" in form:
    direct = "data/"
    data = "users.txt"

    loginFuncts.validateEntry(
示例#6
0
#!/usr/bin/python
print "content-type: text/html\n"
import sys
import cgitb
import cgi

sys.path.insert(0, "../modules")
import htmlFuncts
import loginFuncts
import os

cgitb.enable()

form = cgi.FieldStorage()

print htmlFuncts.startPageN("Main")

direct = "data/"
logFile = "loggedIn.txt"
dataList = loginFuncts.getFileData(direct, logFile)
ip = os.environ["REMOTE_ADDR"]

for x in dataList:
    if form.getvalue("user") == x[0] and form.getvalue("id") == x[1] and ip == x[2]:
        print "logged in"
    else:
        print "<a href='login.py'>Go log in</a>"

print htmlFuncts.endPage()
#!/usr/bin/python
print "content-type: text/html\n"
import sys
import cgitb
import cgi
sys.path.insert(0, "../modules")
import htmlFuncts
import loginFuncts

cgitb.enable()

form = cgi.FieldStorage()

print htmlFuncts.startPageN("Create an account")

print """
<form method="GET" action="createaccount.py">
	Username: <input name="username" type="textfield">
	<br>
	Password: <input name="pass" type="password">
	<br>
	Commas will be removed from passwords
	<br>
	<input name="done" type="submit" value="yay">
</form>
"""

if "done" in form:
	direct = "data/"
	data = "users.txt"
	
#!/usr/bin/python
print "content-type: text/html\n"
import sys
import cgitb
import cgi
sys.path.insert(0, "../modules")
import htmlFuncts
import loginFuncts

cgitb.enable()

form = cgi.FieldStorage()

print htmlFuncts.startPageN("Create an account")

print """
<form method="GET" action="createaccount.py">
	Username: <input name="username" type="textfield">
	<br>
	Password: <input name="pass" type="password">
	<br>
	Commas will be removed from passwords
	<br>
	<input name="done" type="submit" value="yay">
</form>
"""

if "done" in form:
    direct = "data/"
    data = "users.txt"