|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
retrieving cookies
how do you check if theres a cookie and if there is retrieve it???
|
|
#2
|
|||
|
|||
|
Also i'm creating a message board like this one witth MySQL as my database?? How do you recommend i set up the databases and tables.
so far i have: users>users>(all the users) General>threads>posts with general being a database containg the threads and posts of the message board section general. Then I would have another database for each section of the message board. Like Spam, and Linux |
|
#3
|
||||
|
||||
|
See the documentation of the load method of the Cookie object here.
http://web.pydoc.org/2.2/Cookie.html As to your second question, is there any reason you should have separate databases. I mean, can you just store all the information in different tables of the same database?
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#4
|
|||
|
|||
|
i dont know can I?? how would i do it, how would i label wich thread belongs to which section of the message board i.e. general or spam. Another problem i have run into is if a have a list of names which link to the different parts of the sections All on one page, how do i know one the user chose?? There doesnt seem to be a value key in a hyperlink. Would i have to create a different script for each section of the message board(basically changing the values of which section to show) or is there an easier way.
|
|
#5
|
|||
|
|||
|
ahh can you give me a specific example of how to load a simple cookie because i cant find any examples on the page you diricted me too.
|
|
#6
|
||||
|
||||
|
Something like this:
Code:
import os import Cookie cookies = Cookie.Cookie() cookies.load(os.environ["HTTP_COOKIE"]) print cookies print cookies["cookie_name"].value |
|
#7
|
||||
|
||||
|
Quote:
You migt find this thread interesting http://forums.devshed.com/t81768/s.html Edit: On the subject of database setup i'd go with scorpi and only use one database which holds multiple tables, one for 'users' which containts profile info (nick, email etc) and then seperate tables for each section you want to add.. as for naming thats just something your gonna have to play around with ![]() Mark. Last edited by netytan : October 15th, 2003 at 02:44 AM. |
|
#8
|
|||
|
|||
|
<a href="mycgi.py?show=1">page 1</a>
how would i retrieve show=1 |
|
#9
|
|||
|
|||
|
Also do you recommend having 1 database with a table for users, and then
a table for each section? and then when a user posts the usrname, post, and thread go in the table. Then when someone request a specific thread i search through the table and take evrything where thread = thatthread?? thanks a lot |
|
#10
|
||||
|
||||
|
Quote:
That's not a cookie, that's a query string variable. See http://www.python.org/doc/1.5.2p2/l...cgi_module.html and http://www.python.org/doc/1.5.2p2/l...cgi_module.html for examples of how to parse the variables. |
|
#11
|
|||
|
|||
|
can you give me an example of how to parse the header i'm still very much a newb. Oh and i do know that is a header
![]() |
|
#12
|
||||
|
||||
|
Code:
import cgi vars = cgi.FieldStorage() print vars["show"].value We have a pretty good python CGI tutorial here at devshed. See http://www.devshed.com/Server_Side/Python/CGI for more. Hapy reading ![]() |
|
#13
|
||||
|
||||
|
Quote:
I personally would go for 1 user table, and a new table for each forum you want to create. so if you this forum would be in a table called 'Python' and the perl forum would be in a table named 'Perl'.. somewhere in each forum table (possibly the id) should point at the main thread (just to make it easier to pull results), it's been a while since i messed around with message boards.. but i'm sure you'll get it ![]() Half the trick here is to use the data you get from the query string (as demistrated by scorpi) to determin what data you pull from the database. And when you have the shell you can build boundless features into it pretty easily! I for one would be very interested in your final piece , so make sure you post your code and give a lil speach when you done (that is if you don't mind)Mark. Last edited by netytan : October 16th, 2003 at 07:09 AM. |
|
#14
|
|||
|
|||
|
I plan to release it under the gpl, cuz i got so much help from everyone.
I'll probaly create a 'company' called Radiol Technologies and a website to go with it |
|
#15
|
|
|
|