Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old October 14th, 2003, 06:29 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
retrieving cookies

how do you check if theres a cookie and if there is retrieve it???

Reply With Quote
  #2  
Old October 14th, 2003, 06:42 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #3  
Old October 14th, 2003, 06:59 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,394 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 8 h 36 m 18 sec
Reputation Power: 715
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

Reply With Quote
  #4  
Old October 14th, 2003, 07:23 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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.

Reply With Quote
  #5  
Old October 14th, 2003, 07:26 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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.

Reply With Quote
  #6  
Old October 14th, 2003, 07:33 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,394 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 8 h 36 m 18 sec
Reputation Power: 715
Something like this:
Code:
import os
import Cookie

cookies = Cookie.Cookie()
cookies.load(os.environ["HTTP_COOKIE"])
print cookies
print cookies["cookie_name"].value

Reply With Quote
  #7  
Old October 15th, 2003, 02:32 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Originally posted by Arkamir
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.


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.
__________________
programming language development: www.netytan.com Hula


Last edited by netytan : October 15th, 2003 at 02:44 AM.

Reply With Quote
  #8  
Old October 15th, 2003, 02:25 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
<a href="mycgi.py?show=1">page 1</a>

how would i retrieve show=1

Reply With Quote
  #9  
Old October 15th, 2003, 02:32 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #10  
Old October 15th, 2003, 02:53 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,394 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 8 h 36 m 18 sec
Reputation Power: 715
Quote:
Originally posted by Arkamir
<a href="mycgi.py?show=1">page 1</a>

how would i retrieve show=1


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.

Reply With Quote
  #11  
Old October 15th, 2003, 06:45 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #12  
Old October 15th, 2003, 10:24 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,394 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 8 h 36 m 18 sec
Reputation Power: 715
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

Reply With Quote
  #13  
Old October 16th, 2003, 07:04 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Also do you recommend having 1 database with a table for users, and then a table for each section?


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.

Reply With Quote
  #14  
Old October 16th, 2003, 06:46 PM
Arkamir Arkamir is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 36 Arkamir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #15  
Old November 2nd, 2003, 02:46 PM