Shinyshell Community Forums > Coding >
MyBB's MySQL


[1]


October 16 02009, 19:52 GMT
Peter*
A Pythonic One

Peter's avatar
Location: US
Post count: 99

I'm working on a users system in Python for a site with MyBB in use. I know how to make my own users system , but I don't understand how these passwords are encrypted, or how the loginkey field & cookie works. I really just want to integrate these two things for experimental purposes. ^_~

October 17 02009, 16:31 GMT
Faltzer
Member

Faltzer's avatar
Location: Glendale, New York
Post count: 38
us
import os 

if 'HTTP_COOKIE' in os.environ:
cookies = os.environ['HTTP_COOKIE'].split('; '):
for c in cookies:
(key, value) = c.split('=')
cookie[key] = value
import os

if 'HTTP_COOKIE' in os.environ:
cookies = os.environ['HTTP_COOKIE'].split('; '):
for c in cookies:
(key, value) = c.split('=')
cookie[key] = value
]]>


The cookie you are looking for here is usually the sessionid one, as it gives you all you need to set-up user integration.

With that in hand, query the database's session table where it matches the sessionid. Then you grab the user's information based on the userid that is in that same row you queried. I believe this can be done in one query with JOINs, but there you have it.

This can all be done easily if you were using a web framework. Pylons has request.cookie, so you don't have to do any of that manually.
______________________________
FHQ


[1]



Forum Information
  Currently Active Members [detailed] (0 members and ? guests)
-
Forum Statistics
Topics: 0, Posts: 0, Members: 108.
Welcome to our newest member, adamthephantump
Most members online was 5, on August 28 2009, at 21:49:28.
Legend
    Forums with unread topics in them are indicated by a strong yellow colouring around the forum icon.
    Forums with no unread topics have the standard pale yellow colouring around the forum icon.
    Forums with a blue arrow icon will redirect you to a non-forum page.
    Locked forums have a little padlock by their icon. You won't be able to post in these forums.
Shinyshell Home | Contact | Staff List | Archive | Top 

Conventional Login

Don't have an account? You may want to create one.

OpenID Login
OpenID login and registration is usable, but not finished.
What is OpenID?
Search

(advanced search)
Site Stats
  Total members: 108
  Latest member: adamthephantump
  Members currently online: 0
  Most online: 5 - Aug 28, 2009 (21:49)
  Front page hits: 87998
Developer info
  Site version: 3.5 Alpha
  16 queries - 9 templates
Under the Spotlight
Collide Site
Collide make fabulously dreamy electronic-industrial music, they're one of my favourite bands! Give them a chance to take control of your life - myspace | youtube - "Euphoria".

Collide Site - Hits: 4597

5/5 (2) | Rate this site?