Easiest drop-in PHP authentication solution? - php

Forgive me if this has already been asked (and feel free to provide a reference and close this).
The ultimate goal is to associate some data with each user (obviously) and display that data to users differently based on their roles.
I have looked extensively for a simple, drop-in solution for authenticating users in PHP.
I am not looking for:
A CMS with authentication
A PHP MVC Framework
This project is too simple for both, and while it should go to production eventually, will be performed by novice programmers. I want to be teaching them PHP, not specifics for a CMS or a framework. I am not completely opposed to the idea of a framework, but all the frameworks I have looked at enforce MVC and that is too advanced a concept at this point.
I am looking for something that will allow me to easily register users, login users, and put users into roles. Ideally, this means having a library that will handle the database & encryption logic and provide me with a simple API to do the above. I prefer to provide the library with a database and let it do its thing without any interaction from me - storing data in the session is also preferable but not required.
I know I could easily do this myself, but I want to make things simple for those I am teaching. A library/component/etc is what I want for this. I've been all over PEAR, and the modules there seem overly complicated. The two authentication providers given in the PHP5 documentation seem unclear to me. Examples of those in action, if they do what I've described, would work. Any ideas?

Login Sessions
It's a little out-dated, but still comes with great concepts.

Related

PHP Frameworks for JQUERY/AJAX Client Mainly for Authentication Process and Database Manipulation. Which one?

I'd like to have "PRO" Php developers advice regarding the framework they use , specially for an application that use "mainly" php as authentication process, connector and db data process in relationship with an Ajax/Jquery Client ... I use Zend Framework , but is that framework the lightest solution for that kind of process ?
In my list i have :
Symfony http://symfony.com/get_started
Kohana http://kohanaframework.org/
Ok,
Here are further details on what i need :
I'm developing a website that needs these requirements :
Simple login with classic interface and social ones (facebook, twitter).
When user login , he can just change some parameters on his account (pseudo, password and so on).
Then, the only thing he can do is creating what i will call "objects" that have different properties.
These "objects" can then be share with others through a graphical interface.
Nearly everything on the client side will be just displaying these objects with Jquery/Ajax in relashionship with PHP...
So, i just need PHP for oAuth process and datas manipulations...
I'm trying to find the best solutions regarding this little scenario...
For now, i use Zend Framework on Zend server, it works, but seems to be a little bit "heavy" .. so my question is : is there a better 'lightest' way to consider this ?
Dunno if i'm clear :-/ ...
So, thanks in advance !
Aside agreeing with Gordon, I can see you're just looking for someone to suggest something besides zend.
I would go with Kohana over Symfony because Kohana is much easier to understand out of the box and doesn't require any special setup to work with. It is fast enough to supply you with whatever I assume you need at this level - and by that I mean that if you were building an enterprise level site like ebay you wouldn't be asking this question at all.
You don't need to use the ORM for database interaction but if you decide to it is very easy to understand and will make the development process much faster, even if you don't know the ins and outs of it.
Officially my answer is to agree with Gordon though. If he posts his comment as an answer I will upvote it because you shouldn't just ask the community what they use while providing a tiny list of things you need that almost every site on the planet also uses. It's just too vague.
And yes, I use Kohana all the time. Codeigniter as well if you want another option.
Limonade is another option for very tiny micro-framework. I dislike it for a huge number of reasons but it is not hard to use.

PHP, Zend Framework, Wordpress, need to find some clarity

First off, I'm new to web development. I am fairly comfortable with HTML/CSS, and I am building my first site for a friend's business. I want to include a contact form, so I downloaded one from CodeCanyon. It is perfectly fine, but I'm in this to learn how to do this, so I scrapped the downloaded form and set out to learn some PHP. (I realize that later on, from a profitability standpoint, it may be a wiser decision to use these types of plugins rather than doing it all myself; would love opinions on this as well).
I learnt how to write a simple e-mail contact form from some tutorials online, but quickly found there's much more to it when you get into address validation, and preventing spammers from hijacking your form, etc. Should I continue to try to learn how to do the whole thing myself? If so, What is the best resource available?
I noticed people saying great things about Zend framework. Can someone explain what it is in simple terms?
Also, I haven't used Wordpress yet, but it seems the best use of this (aside from using it to create quick websites on the cheap) is as a CMS so your clients can update their content later. Does Zend framework also have some kind of CMS element to it?
I know this is kind of a complicated series of questions, but I'm trying to get some clarity. To those of you who have been at this a while, all the different products, languages, acronyms, etc. may seem like a piece of cake, but to a newbie like me, its hard to figure it all out without some kind of sounding board.
Kind of an open question but:
Zend Framework is a set of libraries that help you create php applications. They have a set of predefined classes that simplify tasks like Access Control List (User Login and such) or access Google APIs (like calendar and email). To take advantage of those libraries you need to interact with them in the programing level. (that is, you need to know how to program in PHP and how to access those classes). Here's an example:
require_once('Loader/autoloader.php');
$acl = new Zend_Acl();
$acl->add(new Zend_Acl_Resource('view'));
$acl->add(new Zend_Acl_Resource('edit'));
$acl->allow('guest', null, 'view');
$acl->allow('editor', array('view', 'edit'));
This creates a User Role named guest and editor, and gives permissions accordingly.
Wordpress is a CMS (like joomla and Drupal, for instance). You don't need any PHP knowledge to create a site with these tools and you interact with the modules in the admin level. You can actually integrate Zend Framework (or any other framework) with those CMS, but then again you need not only knowledge in PHP but also in the framework itself and in the structure of the CMS.
To summarize, PHP is powerful yet relatively easy programming language. Should you decide to learn it, you should start by doing some basic tutorials like this one to familiarize yourself with the language. The learning curve might be a little steep but it pays off. Once you feel you can do most tasks, you can try to work with a framework (ZEND or SYMFONY, for instance)
If your only objective is just to build sites easily and quickly, you should use a CMS.

Basic User Management, For Custom Site

I have been looking at either coding from scratch a basic login page + session management user validation for a new website I intend to build.
I am wary that this may not be the safest thing for me to do on my own, so I am contemplating using joomla or wordpress for basic user authentication and then having the rest of the site pretty much customised. Is this a good idea, or am I going against how they were designed and is there a better framework I could be using for this simple task? I am not too concerned with language but asp.net or php are definitely preferred.
For ASP .NET you should use ASP .Net Membership
a series of tutorial regarding to implement asp .net membership can be find here
I use Joomla allot, but if everything else is custom, it would probably hold you back rather than help.
I would take a look at http://codeigniter.com and use one of the authentication plugins.
stackoverflow uses OpenIDs, which I think is pretty handy. This will manage your authentication, but you'll still need to "register" the users (ie their user name and profile and OpenID token) on your server. But I think authentication is the biggest headache, so with that out of the way, the rest is pretty standard.
I like WordPress a lot and think it's a good tool for certain things, but I don't think I'd use its codebase as a starting point for a new app. Try a more generic web-app framework in your preferred language... Yii or CakePHP if you want PHP... you'll find user/session/authentication plugins to get you started, and then you can go from there, with a relatively blank slate and the handy don't-reinvent-the-wheel tools a framework provides.

Pre-configured CakePHP with common things like authentication

Has anyone come across a CakePHP system with pre-configured things like authentication with all the login/logout forms, etc? Most websites have some sort of a basic authentication system on top of which everything is built. I was hoping to not go about re-inventing the wheel setting up the most common pages like login, logout, forgot-password. Any help?
CakePHP Cookbook is a good place to start. There is a sample aplication with the authentication stuff done:
http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application
How about you build it the way you want and then reuse that in all of your projects.
It's what I do and it is very much in the spirit of OO and MVC.
In no time at all you'll have your own library of modules/functions or whatever you want to call them.
PoundCake Control Panel plugin
You might find Infinitas interesting. It's a full CMS, but you can probably trim out the core functionality and use that since it's under an MIT license. The names of the main people developing it (ceeram and dogmatic69) are responsible for some of the more interesting (to me) bugs and fixes in the CakePHP bug tracker. This implies that they understand the internals of the framework pretty well.
Try it out and let us know in a comment if it'll function for what you need.

Should I use Drupal or Kohana-type framework for a web "application"

The debate is that I need a PHP Framework/Drupal with the flexibility to add custom features to a potentially large application (web and with an api).
However, with a framework, like Kohana, I see myself tackling and re-inventing the wheel with the simple stuff like account management and cms stuff. Account management and quick data collection, like fast form creation, are tedious in Kohana but appear incredible simple in Drupal. On the other hand, based on my limited Drupal experience, I doubt building rapid custom "features" and allowing users to create "groups" and to manage their own roles within those groups is something Drupal can easily accomplish.
To simplify, is Drupal capable of true Web Applications; where the application is a service and provides custom results to each user? Can it provide a dashboard-like interface for users to change their settings or preferences? Can it aggregate data from particular users to provide better results/info to others?
If so, please point me to some knowledge :-)
I'll admit right away I'm a big fan of Drupal and I have never used Kohana, so this post will be one-sided.
In the company I work for they use Drupal or Zend Framework for pretty much all projects (Drupal being in the majority). Many ZF-oriented people dislike Drupal as it's structure is so far from the object oriented ZF-stuff, and Drupal is "just an CMS". As I see it Drupal is more of a Framework than "just" a CMS, and the best part being that it is incredibly flexible: everything is possible.
And yes there is indeed a module for everything. To be more specific:
On the other hand, based on my limited Drupal experience, I doubt building rapid custom >"features" and allowing users to create "groups" and to manage their own roles within >those groups is something Drupal can easily accomplish.
I can only guess what you mean with rapid custom features, but imo it's easy to expand Drupal with your own modules. Most features are available as (free, community contributed) modules, and many advanced looking features can be easily created for example with the "views" and "cck"-modules.
http://drupal.org/project/cck
http://drupal.org/project/views
Creating groups:
"organic_groups" ( http://drupal.org/project/og)
"og_user_roles" ( http://drupal.org/project/og_user_roles )
These modules together are what you need to create groups that have group spefic roles (and roles having specific rights). There are probably other ways than using "og_user_roles", but I'm advertising it because I've made a few patches for it a few years ago. The problem is usually a bit too many options.
If you want to extend group specific options you could code your own module, but most likely you don't need to because there already is a module for it. For example, there are at least 120 modules that integrate somehow with the "organic_groups"-module:
http://drupal.org/taxonomy/term/90?page=19
To simplify, is Drupal capable of true Web Applications; where the application is a >service and provides custom results to each user? Can it provide a dashboard-like >interface for users to change their settings or preferences? Can it aggregate data from >particular users to provide better results/info to others?
In short, yes. There are so many ways to achieve something you described. But probably they would involve at least the excellent "views"-module. I think of views as some kind of ultimate abstraction SQL layer and UI for anyone. And there are over 300 modules that somehow integrate with Views... ( http://drupal.org/taxonomy/term/89?page=55 )
This sounds that Drupal is all about the modules.. and I know some of my collegues even dislike it for that, because you never get to code fun stuff because it's already been done. At least you can look at the module code and learn from that. Or laugh at it, there's lots of badly programmed modules around too.
When you get to coding modules, you'll probably need lots of time to get used to the Drupal API, Forms API, Module hooks, the Theme override system, and the endless options from contrib modules. But it's worth the trouble.
I find this site very usefull to find a module for some specific need. The site shows the same module info as Drupal.org, but also user feedback/ratings, to find the best option:
http://drupalmodules.com/
If it's unclear, my answer would be go with Drupal :)
PS: D7 should be out very soon. Some might wait for it instead of starting with D6. During D5 people would wait a long time before upgrading to D6 because of missing modules. I believe for D7 the most important modules will be available for D7 very fast. Some research at the moment (04.12.2010):
About 190 modules promise to have a Drupal 7 version the day D7 is released:
http://drupal.org/project/modules?solrsort=sort_title%20asc&text=d7cx&display=table
About 130 modules are already available for D7 (most are included in the previous link):
http://drupal.org/project/modules?filters=drupal_core:103&solrsort=sort_title%20asc&text=d7cx&display=table
EDIT: As a newbie I'm only allowed to post one link, so, I removed http:// from the drupal.org-links
I worked with both Drupal and Kohana.
In my insight it really depends what you want to do. If you are going to make a web application that needs to grow a lot and should be flexible for it's growth then I recommend using Kohana. Kohana is made to keep your codebase clean and supporting in DRY (Don't Repeat Yourself). While it likely doesn't have as many modules as Drupal it does have some Auth and ACL modules.
If you want to be done fast and you don't mind making your application out of others their modules Drupal will get your work done fast. But keep in mind that when you are going to extend you will most likely run into problems that come from modules you don't know. Also it takes a bit flexibility from you.
Ultimately it's your choice. But I recommend using a MVC framework if you are going to write it from scratch.
There is no impossible thing to accomplish. The question is do you want to work with someone else code and try to figure out how to dig inside and extend so it can fit your needs or you want to go with a light framework like Kohana or maybe CodeIgniter(my personal favorite) and drive your own car, although you might need to "invent" some of the wheels.
Go ahead and research what plugins are there to your framework of choice as there are a lot of frameworks providing very good solutions which can provide you with these wheels.
In my personal opinion the time you will spend studying Drupal will be equivalent to the time needed for you to create your basic CMS functionality, but the nerves you will use dealing with stuff out of your control like the core Drupal code will shift the scales in favor of Framework.
The fun stuff about Drupal is what the community calls jokingly rule #35: there is a module for it. Unless you want to do something really tricky, you will often find that the functionality has already been implemented and you just need to configure it.
I am new to both Drupal (7.12) & Kohana (3.2.0)... My experience thus far is that Kohana's documentation SUCKS (or at least, what I've seen of it). And if their website and/or forum is written in Kohana, it sucks as well (slooooow, with overlapping fields, etc.). Whereas with Drupal, it has been clean and so far, very efficient (as best I can tell thus far).
I guess I'm wondering if the comments thus far were focusing on Drupal 6.x and haven't taken into consideration the more recent innovations in Drupal. Any thoughts/comments? Thanks.
As a newbie web developer, I can tell you that you need to analyze the use cases for your web application very strictly. If you are able to cover at least 75% of the use cases you foresee, that's a good start.
With that done, you need to figure if Drupal/Joomla/CMS(x) will give you all of that and with another potential unknown 5-10% feature creep. If so, you maybe better off getting in with Drupal etc.
Else, I think CodeIgniter or Symfony are great PHP frameworks to jump in with. Both offer solid tutorials, video and otherwise, and a helpful community. Kohana, which I am working on, I think you should get into if you really understand PHP and its flaws and realize that speed will be a critical factor. Those are the two big strengths that KO3 brings to the table and you should really need them to use it.
Hope this helps.

Categories