It is not the database causing it, look at the size of the Auth library being loaded.
Anytime you load a library etc the timming is going to take longer.
Sure you have 1/3 seconds.
But now you are loading the Auth library form validation library session library, Auth model, Auth helper form helper url helper email helper and Auth lang.
1 second more is great for what Auth is loading speed wise.
The Authentication Library shouldn’t be adding that much time to your application. InsiteFX is on the right track saying there will be some added time to your application, but two seconds is a nightmare.
What version of PHP are you running?
What version of CodeIgniter are you running?
Are you sure you’re on The Authentication Library 1.0.6?
Are there any other bottlenecks in your application?
Where are you seeing this time addition? Everywhere? Only on the admin panel?
another question here: when and how exactly are the forms processed? like i see the registration function inside the auth library loads the registration view, but also processes it, but i can’t quite figure out how.
I need so somehow return TRUE if it’s processed successfully, for registration, login, ... since i want to use jQuery together with this library.
another question here: when and how exactly are the forms processed? like i see the registration function inside the auth library loads the registration view, but also processes it, but i can’t quite figure out how.
I need so somehow return TRUE if it’s processed successfully, for registration, login, ... since i want to use jQuery together with this library.
thanks,
Kenny
If you open up the file libraries/Auth.php – you can see the two functions in there, login() and register(). That’s how it all works.
You could add some code into that file to shoot off a call to jQuery so when a user is registered/logged in you can do what you like with it.
Yes it’s not pretty but it’s the only way I can think of.
I am going to do some more research, I expect the problem is with what I am doing, rather than the library itself.
If I can figure it out I will post what the solution was in case it helps others.
If I can’t I will come back with more details looking for help
I am using
Auth 1.0.6 and the latest version of codeigniter
Loading Time Base Classes 0.0161
Controller Execution Time ( sited / Index ) 5.0919
Total Execution Time 5.1081
The auth sessions query and user set identifier SQL queries are very fast, not half a second in total.
All my pages are very slow if I am logged in, but fast if I am logged out. I suspect it’s maybe something to do with apache and sessions.
Cheers
Sam
Hi, I think your problem may be related to Auth connecting to random.org in Auth.php line 340, method _generate(). Try commenting the first two options and leave the internal generator and see what happends.
If you need a unique identifier or token and you intend to give out that token to the user via the network (i.e. session cookies), it is recommended that you use something along these lines:
This will create a 32 character identifier (a 128 bit hex number) that is extremely difficult to predict.
Example #1 uniqid() Example <?php // no prefix // works only in PHP 5 and later versions $token = md5(uniqid());
// better, difficult to guess $better_token = md5(uniqid(mt_rand(), true)); ?>
But I’m not sure why it says it will only work with php5, as both functions are listed as php4/php5 compatible.
I’m considering using Auth but I don’t understand the rationaly behind connecting to an external site (random.org) to generate this token. Besides, the hosting provider I’m working with doesn’t support url_fopen or curl.
Most modern OSs should provide a reasonably good random generator. I’m working on OpenBSD and I’m sure it does, as most Linux distribs out there. I’m not so sure about it on the Windows systems.
Adam, are there other pieces of Auth that require external support? I don’t feel like reading it all
If you open up the file libraries/Auth.php – you can see the two functions in there, login() and register(). That’s how it all works.
You could add some code into that file to shoot off a call to jQuery so when a user is registered/logged in you can do what you like with it.
Yes it’s not pretty but it’s the only way I can think of.
Thanks,
Adam
Yes I know , though the problem is I don’t know exactly where to add the code. That actually was the problem in the first place. I’d have to include a true, and if it fails, somehow capture the error messages.
I guess all in all, the problem is i don’t quite yet fully understand your coding, as in, the way you put the functions together.
If you open up the file libraries/Auth.php – you can see the two functions in there, login() and register(). That’s how it all works.
You could add some code into that file to shoot off a call to jQuery so when a user is registered/logged in you can do what you like with it.
Yes it’s not pretty but it’s the only way I can think of.
Thanks,
Adam
Yes I know , though the problem is I don’t know exactly where to add the code. That actually was the problem in the first place. I’d have to include a true, and if it fails, somehow capture the error messages.
I guess all in all, the problem is i don’t quite yet fully understand your coding, as in, the way you put the functions together.
Thanks,
Kenny
Those functions follow the pattern laid out in the user guide for the Form Validation Library, here. Have a read of that, it should clear everything up.