4webby BLOG

13 09 2011

Use Django/Pinax authentication in PHP applications

by Daniel | hits(336)

TAGS: php django pinax authentication login

 
Django is a great framework written in python! Some really great features of Django are:

  • django offers  a great structure of pluggable applications [link1 - django packages]
  • django has a great backend out of the box

Pinax puts together a nice set of Django apps in a well integrated way (give it a try)! When you build a Django project you get a very nice user/permissions management interface out of the box. It could be therefore convenient to use it for some PHP projects.

On Stackoverflow I recently found a very nice post explaining how to acieve it-->

-------------------------

If you can unpickle in PHP what Django pickled into the session, then you can just grab the relevant session data directly form database (using session id from cookie), and then you'll have a direct info which user is logged in Django site - if any.

EDIT:

Here's the "encryption" Django uses:

http://code.djangoproject.com/browser/django/tags/releases/1.3.1/django/contrib/sessions/backends/base.py#L91

After "decrypting" you should get something like:

{
   
'_auth_user_id': 123,
   
'_auth_user_backend': 'django.contrib.auth.backends.ModelBackend',
}

-- plus of course other session data you set yourself

-------------------------

 You can get a good hosting plan at really good prices to try PHP, Django/Python, Ruby etc on Webfaction: ssh access to your server, a lot of bandwith and disk space and you can even choose your preferred server location, either Europe or USA.

Enjoy!

 

FURTHER RESOURCES

view/hide comments | add comment

4webby.com

Tags

powered by 4webby.com