sUS [OOP, PHP, MySQL]

Web Developer
Decennium
Joined
Oct 24, 2009
Messages
534
Reaction score
217
sUS (simpleUserSystem)
by Mark Eriksson​
What is sUS?
sUS is essentially what it says on the tin, a simpleUserSystem. It is developed in OOP PHP and makes full use of the Bootstrap and jQuery framework libraries.

Why is sUS being developed?
I am developing sUS for several reasons:​

  1. I haven't developed anything major in a while
  2. I am constantly getting asked to develop user systems for people, so I figured making one and releasing to all would save me time
  3. I do actually enjoy developing things and releasing them as most of the time it helps people
  4. I get bored very easily

Who is developing sUS?
Currently it is just myself, Mark Eriksson (m0nsta.), and I intend to keep it that way as I prefer to work alone in projects like this.

What are the current features of sUS?
  1. OOP (everyone seems to be loving OOP at the minute)
  2. Clean, fast and easy-to-read code
  3. Documented code
  4. Small and easy-to-understand MySQL database
  5. Twitter's Bootstrap -- everyone loves Bootstrap, right?
  6. Custom classes (ties in with OOP) for the MySQL database engine, users and core system
  7. Very secure against MySQL injections, XSS injections, etc
  8. Vanity URLs on user profiles (eg: www.site.com/profile/m0nsta)
  9. Login
  10. Register
  11. Reset Password
  12. User Profiles
  13. Write on user's Walls
  14. Contact form
  15. Update password/email/profile information/profile picture

What is being worked on in the future?
I only started sUS about 5 days ago (29/11/2012) and have so far made pretty good progress considering I'm voluntarily working alone. Here is a short list of features that I plan to implement into sUS before V1 is released publicly.
  1. Threaded private messaging system (similar to how Facebook handle messages, in large threads rather than singular messages)
  2. A very powerful Admin CP
  3. A simple installer.

Screenshots
I'm sure you're all wetting yourselves with excitement, so I figured I should show you some screenshots of sUS (I didn't just choose to do this, I would be contradicting my own section rules if I never)
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums

Expected Release Date
Well basically all I need to do is the pending features that I have listed above and then I can finally release sUS.

How much will sUS cost?
Don't be daft. How often do I release something and put a price on it?! Of course it's free and open to everyone.

sUS is free software and can be modified under the condition that you leave credits where due to the original developer, Mark Eriksson (m0nsta.).

I hope you enjoyed reading this thread and also hope that you are looking forward to the release of sUS V1.

Best wishes,
Mark Eriksson.
 
The screenshots look nice, good job. I imagine the design is completely and easily customizable, correct?

My main criticism as of now is that by using Bootstrap for the frontend design, you're essentially requiring people to use Bootstrap for their entire project. This could be a major deal breaker for many. Not only if they have preexisting projects, but if they simply don't like or want Bootstrap. If somebody finds it too difficult to code their own user account system, how are they going to deal with using Bootstrap?

Although I'm sure the project is too far along by now, I would suggest that the backend and frontend are separated as much as possible, as to allow a completely different frontend to be layed on top of your preexisting backend, thus making it that much more usable by the general population.

Alternatively, while moving forward, you could potentially go the route of making this a CMS. Not only adding in the few features you've already stated, but also a CMS system. That would make my previous comments much less meaningful, as the intention would be to use this system for/as your entire website rather than using it as part of a base.

I'll comment more after the code is released and I comb through it :).
 
Some suggestions/tips/questions:

Why didn't you use MySQLi? Any reason for choosing the mysql_* functions?

It should also be possible to set debug mode because now you will always execute "or die(mysql_error())" when a query fails. (fetch_array() if I look at the screenshot)
The customer/client should not see such errors.

Are you using MD5 for password hashing?
Don't use it. Use something such as bCrypt.

Looks good other than that.
 
Some suggestions/tips/questions:

Why didn't you use MySQLi? Any reason for choosing the mysql_* functions?

It should also be possible to set debug mode because now you will always execute "or die(mysql_error())" when a query fails. (fetch_array() if I look at the screenshot)
The customer/client should not see such errors.

Are you using MD5 for password hashing?
Don't use it. Use something such as bCrypt.

Looks good other than that.

Where are you seeing that he's using the old mysql lib? He said that the system will support MySQL, I never saw anything that said it uses this or that lib, nor did I see any links to code; do correct me if I'm just blind.

In regards to passwords, I don't really know why that guy is saying bCrypt is a "one-way hashing algorithm". A hashing algorithm implies it's one-way, does it not? Maybe he meant a one-way encryption-esque algorithm; poor terminology, still.

A hash isn't enough, bCrypt or not. There needs to be a salt (and with a open source script, the ability to configure the salt easily) and then that all needs to be stretched. I didn't bother questioning this yet as he hasn't released any code :):.
 
Where are you seeing that he's using the old mysql lib? He said that the system will support MySQL, I never saw anything that said it uses this or that lib, nor did I see any links to code; do correct me if I'm just blind.

In regards to passwords, I don't really know why that guy is saying bCrypt is a "one-way hashing algorithm". A hashing algorithm implies it's one-way, does it not? Maybe he meant a one-way encryption-esque algorithm; poor terminology, still.

A hash isn't enough, bCrypt or not. There needs to be a salt (and with a open source script, the ability to configure the salt easily) and then that all needs to be stretched. I didn't bother questioning this yet as he hasn't released any code :):.

Look at the image. mysql_error(), mysql_fetch*.

Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums
 
Look at the image. mysql_error(), mysql_fetch*.

Markshall - sUS [OOP, PHP, MySQL] - RaGEZONE Forums

Nice catch! If he's using the mysql lib that means, amongst other things, that he doesn't have access to prepared statements as mysqli and PDO do. That means sub-par security filters have to be used in place of the much more secure prepared statement. :/:
 
It's not that 'Everyone seems to be loving OOP at the moment'.

It's business logic. Every PHP project should use OOP because it allows you to grab class variables easily. Without OOP you would have to kind jump through hoops to get the variables you want in a class.
 
It's not that 'Everyone seems to be loving OOP at the moment'.

It's business logic. Every PHP project should use OOP because it allows you to grab class variables easily. Without OOP you would have to kind jump through hoops to get the variables you want in a class.

OOP has flaws too, it doesn't suit every project. I use OOP in game projects because it's much more natural to represent game data in object classes(as opposed to representing in data structures).

Usually, you wouldn't have classes at all in a standard procedural programing. You would use structures of data(structs), consisting solely of variables.

One issue with object oriented programming is the fact that it often limits the modularity, which in turn can slow large projects down significantly. There are reasons why most kernels are implemented in C and not in C++.

Object oriented programing is actually quite an old pattern. It's losing popularity in the active development world due to its various issues and complexities. I'm not so sure why everyone on RaGEZONE is crazy about it, but it is easy to learn and work with for small projects in general.
 
OOP has flaws too, it doesn't suit every project. I use OOP in game projects because it's much more natural to represent game data in object classes(as opposed to representing in data structures).

Usually, you wouldn't have classes at all in a standard procedural programing. You would use structures of data(structs), consisting solely of variables.

One issue with object oriented programming is the fact that it often limits the modularity, which in turn can slow large projects down significantly. There are reasons why most kernels are implemented in C and not in C++.

Object oriented programing is actually quite an old pattern. It's losing popularity in the active development world due to its various issues and complexities. I'm not so sure why everyone on RaGEZONE is crazy about it, but it is easy to learn and work with for small projects in general.
Your points against OOP could not be more incorrect. OOP does not limit modularity. In fact, OOP comes with a very modular set of design patterns. The reason so many people use OOP is because it supports so many design patterns which are common in large projects. With procedural code you always have to be aware of what variables are being used. Typically, you rely heavily on global variables and may accidentally or intentionally change those global variables as you go. In any form of OOP (prototypical or classical) you can rely much less (or in the prototypical case, not at all) on the global scope and variables declared there. In classical OOP, unfortunately, all classes are defined in the global scope of the program and the names must be carefully decided and class-files carefully organized so not to conflict the global namespace. Classical OOP is still very popular, but I find it's reliance on global is significantly a downfall. Since procedural style is much worse, I can see why you didn't mention that.
 
Your points against OOP could not be more incorrect. OOP does not limit modularity. In fact, OOP comes with a very modular set of design patterns. The reason so many people use OOP is because it supports so many design patterns which are common in large projects. With procedural code you always have to be aware of what variables are being used. Typically, you rely heavily on global variables and may accidentally or intentionally change those global variables as you go. In any form of OOP (prototypical or classical) you can rely much less (or in the prototypical case, not at all) on the global scope and variables declared there. In classical OOP, unfortunately, all classes are defined in the global scope of the program and the names must be carefully decided and class-files carefully organized so not to conflict the global namespace. Classical OOP is still very popular, but I find it's reliance on global is significantly a downfall. Since procedural style is much worse, I can see why you didn't mention that.

I said OOP often limits modularity. The main reason for this is because of polymorphism, which causes derived classes to depend on base classes. This can cause unnecessary dependencies that reach across modules. Of course, polymorphism can help improve organization, but it trades off modularity in many cases. I admit that this isn't the best argument for using procedural over object oriented design, but it's something to think about.

My main point is that forcing OOP on every project is a bad idea. Even looking at this case, OOP in PHP can be awkward in many cases due to PHP's stateless nature.

By the way, why are you always trying to start arguments with me? You usually pick on pretty general/neutral statements, which makes me wonder if you have some sort of grudge against me lol.
 
A well designed OOP application does not limit modularity. One of the main purposes of the object oriented paradigm is to increase the maintainability of the project. The paradigm was essentially made with large projects in mind. It makes even large projects understandable and maintainable. Maintainable means many things - one of them often being ensuring flexibility and extensibility.

That being said, I agree with mootie's point regarding forcing OOP on every project - this is a bad idea. OOP is very often a detriment for small projects. It can easily take longer to build a small project using the object oriented paradigm rather than the procedural programming paradigm. It could also barely, if at all, affect maintainability. This really does vary on a project to project basis though, as "small" is extremely vague. With experience brings insight into many things - hopefully including the knowledge of when to and when not to use the object oriented paradigm.
 
I said OOP often limits modularity. The main reason for this is because of polymorphism, which causes derived classes to depend on base classes. This can cause unnecessary dependencies that reach across modules. Of course, polymorphism can help improve organization, but it trades off modularity in many cases. I admit that this isn't the best argument for using procedural over object oriented design, but it's something to think about.

My main point is that forcing OOP on every project is a bad idea. Even looking at this case, OOP in PHP can be awkward in many cases due to PHP's stateless nature.
I agree that for smaller programs- say around 200 lines or so- OOP is cumbersome. I typically use prototypical inheritance in JavaScript rather than Classical OOP in PHP. Prototypical inheritance is light-weight compared to classical OOP- and you're clearly talking about the classical style. I agree that classical OOP is quite clunky, however, for large projects- and even medium projects such as this- the advantages of a well designed framework out-weigh the downfalls of the clunky syntax/semantics.
By the way, why are you always trying to start arguments with me? You usually pick on pretty general/neutral statements, which makes me wonder if you have some sort of grudge against me lol.
I apologize if that's how I come off, I'm not trying to pick on you. We must go about this kind of work differently.
 
Last edited:
thats pretty nice, at most the design ... but the language *caught*. im working on similar in asp.net/c# by building login/register/mail controls linked to mssql (fully changeable ofc). i like your simple design, tho i hope u care about many possibilities to configure the layout very easily. later, on my project, i can simply put the user controls on any website, need 4 tables and building some sweet css ... done. (i made it provides me many aspx settings to my properties to change the layouts and texts very much.

what u should think of is your protection and to make everything settable from outside to get the most wishes by clients very very easily. in point of security u should think of ip/username bruteforce gate, sql injection safe, wrong POST request safe, accuracy error handling, session/cookie lifetime security and alerts.

also think on creating a multilanguage system, idk what would be the best system to accomplish this, in my enviroment i would use a property setting file. ^^ Additional a table could be made for this too.

btw, 2 two cents to u php is good for nothing, javascript isnt good server sided. dont hate me for this xP
 
I've read all of your replies and understand them all and where you're all coming from.

I like the idea of the language system but I think I'll leave that for the next release as of now.

I like the idea of a templating system but as timebomb said (I think), I'm too far ahead to go rummaging about with all that so yet again, I'll save that for the next release.

As to the people asking why I used Bootstrap, I'll tell you:

Bootstrap had all the components I needed, the drop-down menus, the dialog/modal boxes, the CSS already set up for me, so it saved me time going making my own layout only for someone to pull out all the PHP coding and use it on their own site, and yes I'm speaking from personal experience because it's happened before and I'm sure it's happened to every developer and it's so annoying especially when they claim it as their own, but next release I'll probably still use Bootstrap because of the functionality of it, but I will more than likely design my own Bootstrap theme.

Thanks for the feedback,
Mark.
 
btw, 2 two cents to u php is good for nothing, javascript isnt good server sided. dont hate me for this xP

Without rambling on to the point where this thread spirals out of control, let me just say that you are wrong on oh so many levels. Mind you that doesn't mean PHP isn't a cruddy language.

On topic:
monsta, I personally would have probably just created a bare bones frontend and let people use that as an example or build on top of it to their heart's desire. A user account is just a part of a website; it shouldn't dictate the design. In other words, you should expect, if not encourage people to primarily use the backend (only) - as you're providing them with a user account system, not a full on website/cms/what-not. Just my two cents.
 
Without rambling on to the point where this thread spirals out of control, let me just say that you are wrong on oh so many levels. Mind you that doesn't mean PHP isn't a cruddy language.
"my two cents" is more a mind than a fact tbh. but i believe its right, its your part how u think about it, i saw enough, and i programmed alot of php already.
 
Last edited:
thats pretty nice, at most the design ... but the language *caught*. im working on similar in asp.net/c# by building login/register/mail controls linked to mssql (fully changeable ofc). i like your simple design, tho i hope u care about many possibilities to configure the layout very easily. later, on my project, i can simply put the user controls on any website, need 4 tables and building some sweet css ... done. (i made it provides me many aspx settings to my properties to change the layouts and texts very much.

what u should think of is your protection and to make everything settable from outside to get the most wishes by clients very very easily. in point of security u should think of ip/username bruteforce gate, sql injection safe, wrong POST request safe, accuracy error handling, session/cookie lifetime security and alerts.

also think on creating a multilanguage system, idk what would be the best system to accomplish this, in my enviroment i would use a property setting file. ^^ Additional a table could be made for this too.

btw, 2 two cents to u php is good for nothing, javascript isnt good server sided. dont hate me for this xP

There is nothing special about the design it's just bootstrap everyone could do that :P So the design is not really unique.
 
Back