Welcome Guest, Not a member yet? Register   Sign In
Use existing auth library or write my own?
#1

[eluser]Haskabab[/eluser]
What's up people,

I'm currently developing a text-based rpg, but I don't really want to get into detail about that since it is irrelevant.

But I'm currently thinking about how to do the authorization, I have seen a lot of libraries etc.. out there, but I'm not quite sure if it would be a smart move and what would be best for my situation.

I want a user system which has 2 levels, a user account login, then once the user is logged in they log in with their character (they can have more than one character).

So what I had in my non-codeigniter version were the following sessions:

$_SESSION['s_userid'] & $_SESSION['s_charid']

With those values I could check if the player had logged into their account and if they had logged into their character or if they were simply visiting the site.

So should I just get myself a already made library and adjust it so it fits my uses or should I create my own (sounds more appealing to me).

And if I should recreate my own, where do I start? The only functions I basically need is one that checks wether or not the user has logged into their account and one that checks wether or not the (possibly) logged in user has also logged into a character and show them different information on the site depending on those values. Like the menu's etc.

Any advice or some tutorial or whatever that could lead me in the right direction would be really appreciated!

Thanks in advance,
Nick
#2

[eluser]rogierb[/eluser]
Only if you have experience with security, you could build your own.

I would go with an existing one. When using standard ci database session, you can add user data like s_char_id.
That only leaves the login part for the character and you can rip/copy/extend from the existing library.

It seems the fastest and more secure way.
#3

[eluser]Haskabab[/eluser]
I do have experience with security, before using codeigniter I've worked with php for 6 years. I do know what to do in regular php scripts but I'm wondering how i should use it in codeigniter, since I've got no experience with CI at all.
#4

[eluser]rogierb[/eluser]
Well, download a few auth libraries and see how they work. That is what I did when I started with CI a few year back. It really helped me to see what others where doing.

Basically the library is nothing more then a class with methods.
The methods use models for the data and views to spit out the login forms etc.

Wherever you need the auth library, load it and call a method.

It is not that different from 'normal' non-mvc PHP.
#5

[eluser]falkencreative[/eluser]
I had to make that decision just recently, and ended up settling on something that was prebuilt yet simple enough that I could customize it to my needs. I agree with @RogierB above -- it definitely helped me to get started, both in terms of speed (I didn't have to code it all from scratch) and also because I got a better idea of how the various files within CodeIgniter work together.

I personally used

http://adamgriffiths.co.uk/user_guide/
Screencasts on it: http://programmersvoice.com/codeigniter/...t-2-set-up and http://programmersvoice.com/codeigniter/...screencast

but there are quite a few other libraries out there with varying feature sets. http://codeigniter.com/wiki/Category:Con...ntication/
#6

[eluser]Haskabab[/eluser]
Thanks to you both for your replies. I have downloaded some libraries and looked through them as you suggested, which helped me a lot and I'm currently trying to develop my custom library.

Thanks falkencreative for the links, I'll make sure to check them out.




Theme © iAndrew 2016 - Forum software by © MyBB