Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12

    retrieving cookies


    how do you check if theres a cookie and if there is retrieve it???
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    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
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4248
    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

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    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.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    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.
  10. #6
  11. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4248
    Something like this:
    Code:
    import os
    import Cookie
    
    cookies = Cookie.Cookie()
    cookies.load(os.environ["HTTP_COOKIE"])
    print cookies
    print cookies["cookie_name"].value
    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

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  12. #7
  13. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.
    Last edited by netytan; October 15th, 2003 at 03:44 AM.
    programming language development: www.netytan.com Hula

  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    <a href="mycgi.py?show=1">page 1</a>

    how would i retrieve show=1
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    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
  18. #10
  19. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4248
    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/li...gi_module.html and http://www.python.org/doc/1.5.2p2/li...gi_module.html for examples of how to parse the variables.
    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

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    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
  22. #12
  23. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,643
    Rep Power
    4248
    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
    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

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  24. #13
  25. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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 08:09 AM.
    programming language development: www.netytan.com Hula

  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    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
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    36
    Rep Power
    12
    would Http_Cookie eqaul the cookie i want to load??

    import os
    import Cookie

    cookies = Cookie.Cookie()
    cookies.load(os.environ["HTTP_COOKIE"])
    print cookies
    print cookies["cookie_name"].value
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo