![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 |
|
Programming Guru
![]() |
Okay, I'll explain the system I have working.
loginrequest is a simple function that takes two POST arguments from the two html forms. If the username is found in the users folder then it encrypts the password in md5 and matches it to that of the encrypted password in their data file from the users bin. If they match, it creates a data file named their IP address, containing their userID (for me, 1) and a unique sessionID up to 25 random letters. A cookie is then stored on the user's computer containing the exact same sessionID. Then when you try to access modifyscores it opens up the data file named your IP address. If there is no data file named your IP it knows you haven't logged in. If there is, it sorts through all your cookies until it finds one with a matching session ID. Once that is found, it displays the data corresponding to the userID in the data file. =D And I think I'm going to stick with how I have it working right now. I like it how Python generates the html, because then I can combine elements from pages easily. What do <head> <body> and <html> tags do? |
|
|
|
|
|
#22 | |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 641
Rep Power: 4
![]() |
Quote:
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
|
|
|
#23 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#24 | ||
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
But I think you might have made it a little complicated for yourself. I think you could you take advantage of CherryPy's sessions, like so: if cherrypy.session.has_key("ipaddress"):
if cherrypy.request.remoteAddr != cherrypy.session["ipaddress"]:
return "Warning! IP Address doesn't match!"
else:
cherrypy.session["ipaddress"] = cherrypy.request.remoteAddr
# output page normallyQuote:
<html> <head> ... </head> <body> ... </body> </html> So if we take your index page, it should look more like so: <html>
<head>
<TITLE>Jammers Base v0.6 (O2Jam Scoring Site)</TITLE>
<style type="text/css">
h1 {
border-width: 1;
border: solid;
text-align: center;
border-right:2px solid #000;
border-bottom:2px solid #000;
margin-right:15px;
padding-bottom:20px;
}
body {
background-image: url(http://cold.byethost2.com/~Sane/bgimage.png);
}
</style>
</head>
<body>
<P ALIGN="RIGHT">
<form action="http://jammersbase.dyndns.org/loginrequest"
method="POST">
Username: <input type="text" name="username">
Password: <input type="password" name="password">
<input type="submit" value="Login">
</form>
</P>
<BR>
<CENTER>
Welcome to Jammers Base!<BR>
The O2Jam Player's base for tracking O2Jam scores!<BR>
<BR>
<form action="http://jammersbase.dyndns.org/viewprofile"
method="GET">
UserID: <input type="text" name="userID">
<input type="submit" value="View">
</form>
<BR>You are Visiter #62
</CENTER>
<BR><BR>
<HR>
<I>Programmed by <a href="/mail to:dr.sane@gmail.com">Saney</a>.<BR>
Powered by <a href="http://pycherry.org">PyCherry 2.1</a>.<BR>
Programmed in Python 2.4 for Dynamic HTML and CSS Display.<BR>
Hosted by DynamicNetworkServices.</I><BR>
<FONT COLOR='WHITE'><FONT SIZE='0'>
<br/><br/>Build time: 0.015s, Page size: 1.19KB
</body>
</html> |
||
|
|
|
|
|
#25 |
|
Programming Guru
![]() |
That's because the html is all dynamically generated and drawn step by step through different functions. And it's not as if I know HTML very well ^^.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|