42 Comments
- mike_p, on 10/12/2007, -0/+5I digg because I use digg for bookmark purposes... maybe we should differentiate digg and have 2 types of "diggs"... or we could simply have an "add to bookmarks".... or I could stop being retarded and just bookmark the actual page... but then why have diggs in the first place...
I'm a complicated guy =( - mirunit, on 10/12/2007, -0/+2nice, if you dont like username as primary just change it?
- artnez, on 10/12/2007, -0/+1Well, I guess it's ok.
I think the implementation sucks in my opinion. I've had to debug some pretty crappy PHP apps and they're structured very much like this.
There's no purpose in creating a "MySQLDB" class that handles user authentication within that class. Instead, there should be a database abstraction class and another class for authorization. Then, there should be another class that acts as a dataobject for the user himself.
Anyway, that's just my opinion. What they have there works, but isn't extensible whatsoever.
Lastly, anyone calling himself the "grandmaster of C++" only makes himself look an amateur. Anyone who's done *any* real work with C++ knows why that is. - rekrapt, on 10/12/2007, -0/+1I'm using it on a new site I'm playing around with. Was really hard to add additional user fields to the database without jumping through some major hoops... for me, anyway.
- Chongo, on 10/12/2007, -0/+1I've been using this script for awhile now. I chopped it up and added my own things, but it works great for what I do.
- Dr1fT3R, on 10/12/2007, -0/+1yes this has been out for a while and is a good script
- abhibeckert, on 10/12/2007, -0/+0"After switching from PHP to RoR, I realized PHP is for web developers who haven't switched, yet."
There are two things holding me back from studying RoR. First off my client's hosts need to have it available, and secondly everything I've seen is that RoR is extremely slow.
PHP's only major drawback is that it lacks a good framework (PEAR is a step in the right direction, but it's currently far from adequate), and that's something that's pretty much resolved by the tools we've developed (unfortunately I don't own 100% of the rights, and can't make them open source :'( ). - johnnybravoh, on 10/12/2007, -0/+0eh - use PEAR's Auth. Pear is built into php. Auth works well.
- ericpp, on 10/12/2007, -0/+0I agree... PEAR is a much better place to look when you don't want to reinvent the wheel...
- elroy, on 10/12/2007, -1/+1i'm surprised this isn't built into the language yet? php has everything built in... anyway i marked it lame.
- fireball74, on 10/12/2007, -0/+0I wrote my own authentication scripts a couple of years ago, using OO PHP, so I won't be using this. I did take a look at it, and although impressive at first glance, it has it's problems as well.
Like somone else said, he uses all sorts of stuff as the primary key. This is not a common practice among the best PHP apps I've seen. Using a simple int is usually a better practice, if for nothing else readability of the database. Also, when setting up a new account, why is he generating a random id? No need for this if there's a numeric primary key.
This is from a quick scan through. But obviously, it's got some week spots that need to be addressed. - abhibeckert, on 10/12/2007, -0/+0"To me, if authentication, and even more generally, security, is to be done right, it has to be designed right in with the rest of the system – that's the only way to be thorough enough to ensure real security. Authentication (which results in a login 'system', of sorts) should be built as a piece of the actual application, not as a module you add in to it"
I agree that a security module shouldn't be "added in" as one of the final steps in developing a project, however there's nothing wrong with using a pre-packaged "security system" as a basis for your project's security.
The security requirements of every project I've ever worked on are pretty much that you can ensure that the currently logged in user has permission to do X with one or two lines of code. That line or two of code will handle asking for a username and password if the user isn't logged in and so on. You seem to be suggesting that the function that does all this should be implemented separately for every single project, despite the fact that every single project has exactly the same list of requirements?
You didn't come across as flaming, you came across as stupid. - motionblur, on 10/12/2007, -0/+0Very nice.
- inactive, on 10/12/2007, -0/+0O so interesting.
- Jack9, on 10/12/2007, -0/+0I use a session object, mysql or mssql object. Why he made this mess, is beyond me. No digg for contributing to stupidity because some poor bastard WILL try to use this.
- Ghoul, on 10/12/2007, -0/+0"username as primary key gives you faster lookups."
When is comparing a 30 character name faster than comparing a 4 byte integer? It's slower and it wastes hard drive space.
Hopefully that was sarcasm. :o - inactive, on 10/12/2007, -0/+0Finding good PHP scripts is hard these days. All the script sites, like hotscripts, are so over run by commercial crap and ripped scripts that rarely work or havn't been updated in years. I started making my own login script, but I'll check this out. Theres a few features I want that this one doesn't have though, and I'd organize things differently. It will at least give me an idea for a good MVC conversion. Check out CakePHP.
- rc_collins, on 10/12/2007, -1/+1username as a primary key is just stupid, you need to have an INT of some sort as your primary key. period.
--dan - inactive, on 10/12/2007, -0/+0username as primary key gives you faster lookups.
still, this is lame. - llbbl, on 10/12/2007, -0/+0I used it for a project about 1.5 years ago. It was pretty good script to start with. Here is another one to get you started. http://www.maaking.com/
- apotropaic, on 10/12/2007, -1/+1Why in the hell shouldn't this be on digg? There's a section from programming isn't there? For the people who want moderators... try ./ and quit bitching about digg not having them! And for the RoR people and people who say that this is useless... STFU! Your comments are comepletly useless to this digg and it makes you look the same. So whats the point of commenting if all your going to do is useless bitching and complaining about digg. If you like RoR, post an RoR link yourself! If you say its useless quit talking about and post something useless then! The first guy acid2 who complaind about it being useless has only post 3 stories and they were all stupid!
- chiology, on 10/12/2007, -0/+0Re: abhibeckert
There's nothing wrong with using existing code, so long as it's design integrates (very) tightly with your existing application design. It should not be an afterthought. I don't think I really communicated that very well in my first comment. For the applications that I've developed, the users are integrated in so many places of the application (based on their activity within the systems) that it's important to have something that fits right there with the data already there. If every project is structured the same way, then, by all means, use the same codebase, but it must be evaluated to ensure that it is ideal and still applicable to the project at hand.
I guess I'm emphasizing that it needs to be integrated consciously and sanely as part of the application design, which this system doesn't lend itself totally to.
And, well, I come across as stupid because I am stupid. Thanks for exercising good society with insult.
M.T. - chiology, on 10/12/2007, -0/+0What the hell is a login system? A system to log you in to a system? A system just for a system? Or maybe just a system for a little script that sucks. Maybe this is a flame, but I think it's obscene to have a login system for any system of value. He packed in all of these features (whoopee), and for what? Sure, it will (hopefully) handle authentication for you (and even remember who we are, holy *****!), but why do we need it as a separate system? To me, if authentication, and even more generally, security, is to be done right, it has to be designed right in with the rest of the system – that's the only way to be thorough enough to ensure real security. Authentication (which results in a login 'system', of sorts) should be built as a piece of the actual application, not as a module you add in to it (that, ohmygosh, remembers you)!
And this is where we really come to understand the PHP community (for the most part).
M.T. - brlewis, on 10/12/2007, -0/+0I should probably write an essay on the value of natural primary keys, but to answer a couple of the commenters here: The username as a primary key means that many queries which otherwise would join against the users table don't have to. I.e. simpler. Using generated sequential ints as primary keys everywhere is only more "readable" if that's all you're familiar with. There is a place for such keys, but they're overused today. For example, how many tables of U.S. states use a 4-byte int as an identifier when there's a 2-byte natural key available?
- snareee, on 12/19/2007, -0/+0I use this script on http://software.carantina.com and it works great
- bmcnitt, on 10/12/2007, -1/+0nothing special. something to throw in the bookmarks if/when you need it later.
- playerx, on 10/12/2007, -2/+1RoR is overrated, the argument of it's fast development capabilities are great and fine, use it to make your to-do lists, etc, RoR is still far from hitting mainstream.
As for the post, well ez-components seems like a great php library, their classes are useful. Might be worth checking out. http://ez.no/products/ez_components - DietrichM, on 10/12/2007, -1/+0Reminds me of the time I started using PHP and looked at various amateur websites looking for this kind of pre-made scripts. Believe me, these website were (and still are) very popular.
Sad to see evolt.org now doing the same. I thought it was at least a bit more professional. - kday, on 10/12/2007, -2/+0@aneeley
I have been hearing about how great RoR is all the time. I find PHP very easy and logical, and I haven't really seen a huge compelling reason to switch. I guess I'm a bit ignorant and don't want to give the time to learn something new.
I guess it's about time for me to learn RoR. - kday, on 10/12/2007, -2/+0Not too bad, but the Login system I created is better :P. This one seems better than most. It was surprisingly hard for me to find a good login system when I was creating a PHP site from the ground up. I got frustrated with the other login systems people have created, so I ended up creating my own.
- f00xx0riz3r, on 10/12/2007, -2/+0thenik: It's a complete PHP login system with admin panel! And remember me function! Can be used to "remember me to digg myself on sunday" for instance.
- jorgevargas, on 10/12/2007, -4/+0*cough* cross site scripting*cough*
- cypher35, on 10/12/2007, -5/+0bah, digg needs moderators.... this ***** should never reach the main page...
- HiddenS3crets, on 10/12/2007, -5/+0Why is a PHP tutorial on digg?
- TheNik, on 10/12/2007, -6/+0...Ok...?
- screwedcork, on 10/12/2007, -7/+1what a technological breakthrough! i'm sure this has never been created before
- aCiD2, on 10/12/2007, -7/+0When will you all stop posting useless things that we couldn't google for ourselves and get back to the real technology news - the actual purpose of digg? Sorry no digg for just plain crappyness


What is Digg?
The Digg Toolbar for Firefox lets you Digg, submit content, and keep track of Digg even when you're not on the Digg site. Download the official