EllisLab text mark
Advanced Search
3 of 10
3
   
The Authentication Library 1.0.6
Posted: 10 September 2009 03:38 AM   [ Ignore ]   [ # 31 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Sorry Adam,

I was refering to this code in the register method.

if ($this->config['auth_remember'=== TRUE)
{
   $this
->_generate();

So what is this code doing Adam?

For remember me you just need to set it in a cookie right.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 10 September 2009 04:04 AM   [ Ignore ]   [ # 32 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
356 posts
InsiteFX - 10 September 2009 07:38 AM

Sorry Adam,

I was refering to this code in the register method.

if ($this->config['auth_remember'=== TRUE)
{
   $this
->_generate();

So what is this code doing Adam?

For remember me you just need to set it in a cookie right.

Enjoy
InsiteFX

That’s the remember me function, not a forgot password function. smile


Thanks.

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

 
Posted: 10 September 2009 10:54 PM   [ Ignore ]   [ # 33 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Thanks Adam,

Was a little confuse on that one, but cleared up.

I have all the stuff in my old system I’ll see if I can get it converted over.

Oh and are you making any progress on the page sections?

I have the menuing system almost finished, just debugging it and clean up.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 12 September 2009 01:06 AM   [ Ignore ]   [ # 34 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-29
307 posts

A few questions after using the Auth library for a bit…

How does the auth library pass information to the view?

If I have the following controller (note the ‘pagetitle’):

class Pages extends Application
{
    
    
function Pages()
    
{
        parent
::Application();
                
        
$this->auth->restrict('admin'); 
        
$this->load->model($this->models."pagesmodel"'pages');
        
        
$data['pagetitle''Page Management';
    
}
    
function manage(){
        $data[
'pages'$this->pages->get_all_pages(); // Grab an array of all pages from the database
        
        
$this->auth->view('pages/manage');
    
}

My view (manage.php) will display an array of pages (i have just var_dump($data) in manage.php)

What I don’t understand is why $data[‘pagetitle’] = ‘Page Management’; does not come through?

However, if I put $data[‘pagetitle’] = ‘Page Management’; inside the manage method, it comes through.

any ideas?

 

Some other questions and suggestions…
Do you intend on adding additional information to the “edit user” page? Right now, all a user can edit is their e-mail address. 

Really, users should be able to modify their password too.  Admins should be able to change their user group from a drop down.

 Signature 

CodeIgniter From Scratch: Day 1 | Day 2 | Day 3 | Day 4 | Day 5 | Day 6 | Day 7

 
Posted: 12 September 2009 03:06 AM   [ Ignore ]   [ # 35 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Hi,

You could pass it in like so:

function manage($data)

Also

$this
->auth->view('pages/manage'$data); 

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 12 September 2009 11:44 AM   [ Ignore ]   [ # 36 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
356 posts

If you change this to be $this->data instead of $data and declare the variable before the constructor, the “Page Management” will come through.


Thanks,
Adam

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

 
Posted: 02 October 2009 04:14 PM   [ Ignore ]   [ # 37 ]   [ Rating: 0 ]
Joined: 2009-09-25
5 posts

Hi,

Does anyone have any suggestions why loading Auth would be slow ?

If I load Auth in a controller, or add it to autoload, it adds about 2 seconds to page load time on localhost!

Profiling tell me that the database queries are actually pretty fast

0.0004     SELECT *
FROM (`ci_sessions`)
WHERE `session_id` = ‘_some_data_here_’
AND `user_agent` = ‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) Ap’

0.0004     UPDATE `users` SET `identifier` = ‘_some_data_here_’, `token` = ‘_some_data_here_’ WHERE `username` = ‘_some_data_here_’

Suggestions appreciated, thanks.

 
Posted: 02 October 2009 04:32 PM   [ Ignore ]   [ # 38 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

That is because your suppose to extend the Auth Controller see below.

class Example extends Application
{
    
function Example()
    
{
        parent
::Application();
    
}

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 02 October 2009 04:50 PM   [ Ignore ]   [ # 39 ]   [ Rating: 0 ]
Joined: 2009-09-25
5 posts

InsiteFx, Thanks for the help.

I was doing it incorrectly, I have modified my controller to extend the Application class, and have it’s contructor call parent::Application();

But the page is stil taking over 2 seconds to load.

Hmm

 
Posted: 02 October 2009 05:02 PM   [ Ignore ]   [ # 40 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Well it is going to add time because you are adding a library. It is hard for me to time things because I am on 12 MB broadband connection.

But a number of things could be affecting your timming, like if your running local etc.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 02 October 2009 05:06 PM   [ Ignore ]   [ # 41 ]   [ Rating: 0 ]
Joined: 2009-09-25
5 posts

Well if i run a page without Auth it loads in a 1/3 of a second.

If i load the page with auth it takes 2.3 seconds.

Immediately I thought it would be the database access that Auth is doing, but the profiler tells me the queries are returning very quickly.

At this point I think it’s almost certainly an issue with how I am doing things, some configuration issue. 

Surely it’s not expected that using auth adds 2 seconds to page load time.

Update : It’s only slow when I’m logged in.

 
Posted: 02 October 2009 05:34 PM   [ Ignore ]   [ # 42 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

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.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 05 October 2009 07:31 AM   [ Ignore ]   [ # 43 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
356 posts

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?


Thanks,
Adam

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

 
Posted: 07 October 2009 03:55 AM   [ Ignore ]   [ # 44 ]   [ Rating: 0 ]
Joined: 2009-09-25
5 posts

Thanks for your interest Adam.

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 smile

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

 
Posted: 07 October 2009 09:53 AM   [ Ignore ]   [ # 45 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Are you using normal session or CI database sessions?

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
3 of 10
3